Example: request message for a DPL program through the CICS-WebSphere MQ bridge
This C-language code fragment shows how to call a CICS® DPL program with COMMAREA data through the CICS-WebSphere MQ bridge, by constructing a message buffer and including a WebSphere® MQ CICS information header (MQCIH).
The DPL program that is called must conform to the DPL subset rules.
See the
CICS
Application
Programming Guide
for further
details.
/*
#defines */
#define PGMNAME "DPLPGM" /* DPL program name */
#define PGMNAMELEN 8
#define CALEN 100 /* Commarea length */
⋮
/* Data declarations */
MQMD mqmd ; /* Message descriptor */
MQCIH mqcih ; /* CICS information header */
MQCHAR * Commarea ; /* Commarea pointer */
MQCHAR * MsgBuffer ; /* Message buffer pointer */
⋮
/* allocate storage for the buffers */
Commarea = malloc(CALEN * sizeof(MQCHAR)) ;
MsgBuffer = malloc(sizeof(MQCIH) + PGMNAMELEN + CALEN) ;
⋮
/* Initialize commarea with data */
⋮
/* Initialize fields in the MQMD as required, including: */
memcpy(mqmd.MsgId, MQMI_NONE, sizeof(mqmd.MsgId)) ;
memcpy(mqmd.CorrelId, MQCI_NEW_SESSION, sizeof(mqmd.CorrelId)) ;
/* Initialize fields in the MQCIH as required */
⋮
/* Copy the MQCIH to the start of the message buffer */
memcpy(MsgBuffer, &mqcih, sizeof(MQCIH)) ;
/* Set 8 bytes after the MQCIH to spaces */
memset(MsgBuffer + sizeof(MQCIH), ' ', PGMNAMELEN) ;
/* Append the program name to the MQCIH. If it is less than */
/* 8 characters, it is now padded to the right with spaces. */
memcpy(MsgBuffer + sizeof(MQCIH), PGMNAME, PGMNAMELEN) ;
/* Append the commarea after the program name */
memcpy(MsgBuffer + sizeof(MQCIH) + PGMNAMELEN, &Commarea
CALEN ) ;
/* The message buffer is now ready for the MQPUT */
/* to the Bridge Request Queue. */
⋮