IMS message structure

Each message that is sent to and from IMS can consist of one or more segments. IMS messages often contain multiple segments.

The bit stream that flows between IBM® App Connect Enterprise and the IMS program (also known as the transmission) can contain multiple segments. Each segment begins with the LLZZ and Transaction code fields that are described in IMS nodes. The transmission can contain multiple messages, each one containing multiple segments. The IMS program gets the segments one at a time and typically inserts the output data onto the queue one segment at a time. The IMS program purges the end of a message before it sends the first segment of the next message.

For input messages, each segment includes the LLZZ field. Only the first segment contains the transaction code (Trancode) field. For output messages, each segment includes the LLZZ field. The IMS program gets the segments one at a time. It makes a GetUnique (GU) call to read the first segment of the next message, and a GetNext (GN) call to read the next segment of the current message. The IMS program typically inserts the output data to the queue one segment at a time, and purges the end of a message before it sends the first segment of the next message, as shown in the following diagram.
The diagram shows how IMS processes message segments.
A COBOL IMS program typically includes a copybook with the data structure definition of each segment. The program logic indicates the order in which the segments are retrieved and emitted by the program. The IBM App Connect Enterprise application has two ways to implement this information:
  • Model the entire message in MRM.
  • Model each segment in MRM but configure the message flow to reflect the application logic in determining the order of these segments.
An IMS transaction's response can have various structures:
  • An MRM-CWF structure, such as a message definition that is derived from a COBOL copybook
  • An MRM-TDS structure when the output is 3270-based, such as a list of name=value strings
  • Another structure, such as XML output from a Java™ program that is running in an IMS Java Processing Region (JPR)
If the message definition is derived from a COBOL copybook, a message is a sequence of segments, each of which has a model built by importing its copybook. If the output is 3270-based, each segment is a line of output with an MRM-TDS model built by understanding the IMS transaction program's output.

IMS presents program output as one or more messages (typically, one output message per input message), each of which comprises one or more segments. The IMSRequest node presents the message as a single BLOB. You can parse the message into segments and use Filter or Compute nodes to test the shape of the response to determine how to re-parse the segments with ResetContentDescriptor nodes.

You must set the LL and ZZ values on output. The LL value is the entire length of the segment, including the four-byte LLZZ prefix. Therefore, the message flow typically requires an ESQL expression to calculate the LL value. The LLZZ field must use a big-endian encoding 785.