These excerpts from EGL programs show interaction with IMS™ terminals, message queues, and serial files.
//define PSB Record addToQueue type PSBRecord { defaultPSBName="MYTRXCD1" } // three PCBs required for CBLTDLI on IMS iopcb IO_PCBRecord { @PCB { pcbType = TP } }; elaalt ALT_PCBRecord { @PCB { pcbType = TP } }; elaexp ALT_PCBRecord { @PCB { pcbType = TP } }; // other database PCBs ... end Record myTransactionPart type serialRecord { fileName=”MYMSGQUE” } ... end program addtrans type textUIProgram { alias = “MYTRXCD1”, // IMS requires pgm to match PSB name segmented = yes, @DLI { psb = “mypsb” }} use MYFORMS; // MYFORMS is a formGroup containing FORM1 // declare variables myTransaction myTransactionPart; // serial record for message queue mypsb addToQueue; // psb function main() converse FORM1; // do whatever processing is necessary move FORM1 to myTransaction byName; add myTransaction; end endWhen you generate, you must specify a resource association part that associates the serial file with a message queue and provides the name of the transaction to which it is to be sent and the name of the PCB to use, as in the following example:
<ResourceAssociations name="RESOURCEASSOC601_REORDER"> <association fileName="MYMSGQUE"> <imsvs> <smsgq systemName=”NEXTTRX" pcbName="elaalt"/> </imsvs> </association> </ResourceAssociations>Because addtrans is a textUIProgram, EGL will make it behave properly in an IMS environment and read the message queue until the queue is empty. This means EGL will build a loop into the program such that once the program has finished placing the transaction into the serial file for later batch processing, it will return to the converse statement to request another transaction from the terminal.
//define PSB Record getFromQueue type PSBRecord { defaultPSBName="MYTRXCD2" } // three PCBs required for CBLTDLI on IMS iopcb IO_PCBRecord { @PCB { pcbType = TP } }; elaalt ALT_PCBRecord { @PCB { pcbType = TP } }; elaexp ALT_PCBRecord { @PCB { pcbType = TP } }; // other database PCBs end program gettrans type basicProgram { alias = “MYTRXCD2” @DLI { psb = “mypsb” }} // declare variables myTransaction myTransactionPart; // serial record for message queue mypsb getFromQueue; // psb function main() while (myTransaction not endOfFile) get next myTransaction; // do whatever processing is necessary end end endWhen you generate the program for either the IMS/VS or the IMSBMP environments, you must also specify a resource association part that associates the serial file with a message queue and provides the name of the transaction to which it is to be sent and the name of the PCB to use. In this case, the I/O PCB is used for input, as shown in the following example:
<ResourceAssociations name="RESOURCEASSOC601_REORDER"> <association fileName="MYMSGQUE"> <imsvs> <smsgq systemName=”NEXTTRX" pcbName="iopcb"/> </imsvs> </association> </ResourceAssociations>
Related concepts
DL/I database support
Related reference
add
audit()
close
converse
get next
Related tasks
Interacting with terminals in IMS
Using serial files in IMS