When a message is processed
A program’s response to a message will depend on the type of message the program receives. A transaction code associates a request for information from a terminal with the application program that can process and respond to that request. IMS TM schedules an MPP when there are messages to be processed that contain the transaction code associated with that MPP.
Example: Suppose you have an MPP that processes the transaction code INVINQ
for inventory inquiry. The MPP receives a request from a user at a terminal for information on the
inventory of parts. When the user enters the transaction code for that application program, IMS TM schedules the application program that can process the
request.
When you enter INVINQ and one or more part numbers, the MPP sends your program the quantity of each part on hand and the quantity on order.
When you enter INVINQ at the terminal, IMS TM puts the
message on the message queue for the MPP that processes INVINQ. Then, after IMS TM has scheduled the MPP, the MPP issues GU
and
GN
calls to retrieve the message. To retrieve the messages from LTERM1, the
application program issues a GU
for the first segment of a message, then issues
GN
calls until IMS TM returns a QD status
code. This means that the program has retrieved all of the segments of that message. The program
then processes the request, and sends the output message to the queue for your logical terminal.
(The logical terminal name is in the I/O PCB.) When the MPP sends the output message, IMS TM sends it to the queue for that logical terminal, and the
message goes to the physical terminal. The following figure shows the flow of a message between the
terminal and the MPP.

The following example shows the calls you use, the status codes, and what the input and output
for the inventory inquiry would look like. To show you how to use GU
and
GN
to retrieve messages, and how you insert multiple-segment messages, this example
shows messages containing three segments. If input and output messages in this example were single
segment messages, the program would issue only a GU
to retrieve the entire message,
and only one ISRT
to send the message.
The message formats shown are examples; not all messages are in this format. When the program receives the input message in the I/O area, the first field of each segment contains the length of that segment. This is the LL field in the figure. For clarity, the figure shows this length in decimal; in the input message, however, it is in binary. The second field (ZZ) is reserved for IMS TM; it is 2 bytes long. The text of the message follows the reserved 2 bytes. The first message segment contains the transaction code in the 8 bytes following the ZZ field. These are the first 8 bytes of the text portion of the message.
The format of the output messages is the same. You do not need to include the name of the logical terminal, because it is in the first 8 bytes of the I/O PCB.
PART, QTY, and ON ORDER in the example are headings. These are values that you can define as constants that you want to appear on the terminal screen. To include headings in MFS output messages, define them as literals.
