Segment format

Each output segment has a 4-byte prefix that defines the length of the segment and, if required, specifies whether the segment is the first segment of an LPAGE series.

Option 3 output messages must contain an additional two bytes identifying the relative segment number within the LPAGE series. The following table illustrates the format of an output segment.
Table 1. Format of an output segment
Length of Message Segment 1-Byte Field Reserved for IMS 1-Byte Field Used by Application 2-Byte Field for LPAGE Parameters
LL Z1 Z2 SN FIELDS
Where:
LL
This is a 2-byte binary field representing the total length of the message segment, including LL, Z1, and Z2 and if present, SN. The value of LL equals the number of bytes in text (all segment fields) plus 4 (6 if option 3). The application program must fill in this count. If a size limit was defined for output segments of a transaction being processed, LL must not exceed the defined limit.
Restriction: The segment length must be less than the message queue buffer data size (buffer size—prefix size) specified at IMS system definition. The segment length can be less than the length defined to the MFS Language utility. If a segment is inserted that is larger than the segment defined to the MFS utility, the segment is truncated. No error messages are issued. Fields truncated or omitted are padded as requested in the format definition to the MFS Language utility.

When PL/I is used, the LL field must be defined as a binary fullword. The value provided by the PL/I application program must represent the actual segment length minus two bytes. For example, if an output message segment is 16 bytes, LL=14 and is the sum of: the length of LL (4 bytes - 2 bytes) + Z1 (1 byte) + Z2 (1 byte) + TEXT (10 bytes).

Z1
This is a 1-byte field containing binary zeros and is reserved for IMS.
Z2
This is a 1-byte field that can be used by the application program for control of various output device functions.

For more information on this field, see IMS Version 15.4 Communications and Connections.

SN
For option 3 only. This is a 2-byte binary field containing the relative segment number of the segment within the LPAGE. The first segment is number 1.

A NULL segment can be used to maintain position within a series of option 1 or 2 output segments within an LPAGE. A null segment must be used if segments in the middle of an LPAGE series are to be omitted. If all segments to the end of the LPAGE series are to be omitted, null segments are not required. A null segment contains one data byte (X'3F') and has a length of 5.

The following example shows how to code a null character in COBOL.

Coding a null character in COBOL

ID DIVISION.
PROGRAM-ID. SAMPLPGM.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77  PART1 PIC 9(3) VALUE 123.
77  CUR-NAME PIC 99 COMP VALUE 0.
77  CUR-PART PIC 99 COMP VALUE 0.
01     NULLC.
    02 FILLER PIC 9 COMP-3 VALUE 3.
01  LINE-A.
    02 NAME-1.
       03 NAME-2 OCCURS 30 PIC X.
    02 PARTNUM.
       03 PARTNUM1 OCCURS 10 PIC 9.
PROCEDURE DIVISION.
    MOVE ''ONES' TO NAME-1.
    MOVE 6 TO CUR-NAME.
    MOVE NULLC TO NAME-2 (CUR-NAME).
    MOVE 4 TO CUR-PART.
    MOVE NULLC TO PARTNUM1 (CUR-PART).