beautypg.com

HP NonStop G-Series User Manual

Page 67

background image

Example Client Application DDE Function Calls

Creating Client Applications

110838 Tandem Computers Incorporated

4–11

Numeric data elements are returned as text strings with a leading sign (if negative), an
embedded decimal point (if there are decimal places), no leading zeros, and no
insignificant trailing zeros.

Examples:

REQUEST (“READ-REPLY.FIRST-NAME”)

REQUEST (“MONTHLY-COUNT(12,2)”)

Binary-Pass-Through Approach

To use the binary-pass-through approach, set the DataElementName to the reserved
name _TDMGW-BINARY-BUFFER. You must use the standard clipboard format
CF_TEXT or the registered clipboard format TdmgwBinaryBuffer. Prior to issuing the
DDE Request function, your client application must define a message buffer layout.

Define the buffer with exactly the layout supplied by the Tandem server, but with an
unsigned long integer (4-byte two’s complement number) byte count at the beginning.
This count will be set by the Tandem DDE Gateway to the size of the reply buffer as
configured with the MaxReplyLength attribute of the ServiceName object.

For example, a buffer definition in the C language looks like this:

struct tagReadReply {

unsigned long ulByteCount;

char sFirstName[15];

char sLastName[20]

};

Your client application is responsible for converting the data returned by the Tandem
DDE Gateway from the Tandem data representation to a format that can be processed
by your client application.

Example Client

Application DDE

Function Calls

The following example shows the various DDE functions used in a client application.
All the DDE functions are done in response to one click of a button in the application.
In this example, the one button click causes two different transaction types to be used
on the Tandem system.

Example

INITIATE (TDMGW, PATHWAY)

EXECUTE([INITIALIZESERVICE(READ-EMPLOYEE)])

POKE ("READ-REQUEST.EMPLOYEE-NUMBER", "23")

EXECUTE ([SEND])

REQUEST ("READ-REPLY.FIRST-NAME"), into MyVariableFirstName

REQUEST ("READ-REPLY.LAST-NAME"), into MyVariableLastName

...

...

...

EXECUTE ([INITIALIZESERVICE(UPDATE-EMPLOYEE-SALARY)])

POKE ("UPDATE-REQUEST.EMPLOYEE-NUMBER", "23")

POKE ("UPDATE-REQUEST.SALARY", "50000")