Conversational structure

Structuring your conversational program depends on the interactions between your program and the person at the terminal.

Before structuring your program, you need to know:

The contents of SPA

The SPA that IMS TM gives your program when you issue a GU contains the four parts shown in the following tables.

Table 1. SPA format for AIBTDLI, ASMTDLI, CBLTDLI, CEETDLI, CTDLI, and PASTDLI interfaces
Field Name Field Length
LL 2
ZZZZ 4
TRANCODE 8
User Work Area Variable
Table 2. SPA format for the PLITDLI interface
Field Name Field Length
LLLL 4
ZZZZ 4
TRANCODE 8
User Work Area Variable
The SPA format fields are:
LL or LLLL
A length field that gives the total length of the SPA. This length includes 2 bytes for the LL field. (For the PLITDLI interface, use a 4-byte field. Its contents include 4 bytes for LLLL, minus 2.)
ZZZZ
A 4-byte field reserved for IMS TM that your program must not modify.
TRANCODE
The 8-byte transaction code for this conversation.
User Work Area
A work area that you use to save the information that you need to continue the conversation. The length of this area depends on the length of the data you want to save. This length is defined at system definition.

When your program retrieves the SPA with a GU to start the conversation, IMS TM removes the transaction code from the message. In your first message segment, you receive only the data from the message that the person at the terminal entered.

The following list indicates the ways that an application program processes the SPA. The program must:

  • Not modify the first 6 bytes of the SPA (LL and ZZZZ). IMS TM uses these fields to identify the SPA.

    If the program modifies the SPA, the program must return the SPA to IMS TM (or, for a program switch, to the other program).

  • Not return the SPA to IMS TM more than once during one cycle of the conversation.
  • Not insert the SPA to an alternate PCB that represents a nonconversational transaction code or a logical terminal. The program can use an alternate response PCB if it represents that same physical terminal as the originating logical terminal.
Restriction: If you are using MFS, the IMS TM does not always remove the transaction code.

The appearance of messages in a conversation

Because the first segment contains the SPA, conversational input messages are made up of at least two segments. The input message starts in the second message segment.

The input message segment in a conversation contains only the data from the terminal. During the first step in the conversation, IMS TM removes the transaction code from the input message and places it in the SPA. When the program issues the first GU, IMS TM returns the SPA. To retrieve the first message segment, the program must issue a GN.

The format for the output messages that you send to the terminal is no different than the format for output messages in nonconversational programs.

Saving information in the SPA

After you have processed the message and are ready to reply to the terminal, you can save the necessary data in the SPA. The part of the SPA in which you save data is the work area portion. Use the ISRT call to save data to the work area. This is a special use of the ISRT call, because you are not sending the SPA to a terminal, but rather saving it for future use.

If your program processes each stage of the conversation, you just issue an ISRT call to the I/O PCB and give the name of the I/O area that contains the SPA. For example:
ISRT   I/O PCB, I/O AREA

This returns the updated SPA to IMS TM so that IMS TM can pass it to your program at the next cycle of the conversation.

If you do not modify the SPA, you do not need to return it to IMS. However, the SPA will be passed by IMS TM to your program at the next cycle of the conversation.