DDE Functions

Return to Introduction  Previous page  Next page

TN3270 Plus can function as a Dynamic Data Exchange (DDE) server. This allows DDE client applications to communicate with TN3270 Plus.  For example, some users write Microsoft Excel macros to capture data from the TN3270 Plus terminal window and populate a spreadsheet. TN3270 Plus supports the following DDE functions:

Session Topic Functions

Use the session topic to send data to, and receive data from, a terminal session.

 

Connect

Service=tn3270,Topic=session name | session#session_number

Examples:

Connect Service=tn3270,Topic=mainframe
Connect Service=tn3270,Topic=session#3

 

Return Values

Success: A handle to the conversation.
Failure:  0

Execute

Item=close

closes the session.

 

Item=macro macroname

executes a macro.
macroname is the macro name.

 

Item=script filename

executes a script. 
filename is the full path to the script to be executed.

 

Return Values

Success: (HDDEDATA) DDE_FACK
Failure:    (HDDEDATA) DDE_FNOTPROCESSED

Request

Item=PS

returns the presentation space (screen image).

 

Item=Cursor

returns the cursor position (relative to 1).

 

Item=Rows

returns the number of rows in the presentation space.

 

Item=Columns

returns the number of columns in the presentation space.

 

Item=Emulator

returns the window handle of the TN3270 Plus window.

 

Item=Keyboard

returns "Locked" if the keyboard is locked or else it returns "Clear".

 

Item=OIA

returns the Operator Information Area (note that this is NOT in IBM format).

 

Item=Rnn

returns the nth row in the presentation space.

 

Item=Fnn

returns the nth field in the presentation space.

 

Item=FnnU

returns the nth unprotected field in the presentation space.

 

Item=FnnP

returns the nth protected field in the presentation space.

 

Item=Pnnn[F|Lmmm]

returns a portion of the presentation space.

P = Identifier for starting position

nnn = starting position on screen (relative to 1)

F = return entire field at the starting position

L = Identifier for length

mmm = length of data to return

Examples:

P560 returns screen data from position 560 to the end of the field.

P560F returns the entire field encompassing position 560.

P560L80 returns data from position 560 for a length of 80 characters.

 

Return Values

Success: A handle to the data being returned.
Failure:  0

Poke

Item=Keystroke

sends one or more keystrokes to TN3270 Plus (same format as WinHLLAPI). See the Keystroke Table for a list of all the keystrokes.

 

Item=Cursor

moves the cursor position (relative to 1).

 

Item=EscChar

sets the escape character for Item=Keystroke (default is '@').

 

Return Values

Success: (HDDEDATA) DDE_FACK
Failure:    (HDDEDATA) DDE_FNOTPROCESSED

Advise

Item=PS

sends the presentation space to the client whenever it is updated.

 

Item=Cursor

sends the cursor position to the client whenever it is updated.

 

Return Values

Success: (HDDEDATA) TRUE
Failure:     (HDDEDATA) FALSE

       

System Topic Functions

Use the system topic to send instructions to the TN3270 Plus application.

 

Connect Service=tn3270,Topic=system


Return Values

Success: A handle to the conversation.
Failure:  0

Execute

Item=connect session

connects to a session.
session is the name of the session.

 

Item=close session

closes a session.
session is the name of the session.

 

Item=key keyname

sends a menu key.
keyname is the name of the menu key.

 

Item=macro macroname

executes a macro.

macroname is the macro name.

 

Item=script filename

executes a script.
filename is the full path to the script to be executed.


Return Values

Success: (HDDEDATA) DDE_FACK
Failure:    (HDDEDATA) DDE_FNOTPROCESSED

Request

Item=activesession

returns the session number of the currently active session.


Item=sessions

returns the total number of active sessions.

Tnrun.exe

The tnrun.exe program can execute DDE functions from an external script or program (e.g. Windows Script). The command line format is:

tnrun.exe SYSTEM|session_name command

Examples:

tnrun.exe SYSTEM connect mainframe

(Start the TN3270 Plus session "mainframe")

tnrun.exe mainframe macro login

(Run the "login" macro on session mainframe")

       

Sample Programs

Sample programs are available for download from the Customer Downloads page (http://sdisw.com/customer_downloads.htm) on our web site.

 


TN3270 Plus is continually being improved. To learn more about the latest enhancements, please review our Version History web page.