OriginalLength (MQLONG)

This field is relevant only for report messages that are segments. It specifies the length of the message segment to which the report message relates; it does not specify the length of the logical message of which the segment forms part, or the length of the data in the report message.

Note: When generating a report message for a message that is a segment, the queue manager and message channel agent copy into the MQMD for the report message the GroupId, MsgSeqNumber, Offset, and MsgFlags, fields from the original message. As a result, the report message is also a segment. Applications that generate report messages must do the same, and set the OriginalLength field correctly. The following special value is defined:

    MQOL_UNDEFINED
    Original length of message not defined.

OriginalLength is an input field on the MQPUT and MQPUT1 calls, but the value that the application provides is accepted only in particular circumstances:

  • If the message being put is a segment and is also a report message, the queue manager accepts the value specified. The value must be:

    • Greater than zero if the segment is not the last segment
    • Not less than zero if the segment is the last segment
    • Not less than the length of data present in the message

    If these conditions are not satisfied, the call fails with reason code MQRC_ORIGINAL_LENGTH_ERROR.

  • If the message being put is a segment but not a report message, the queue manager ignores the field and uses the length of the application message data instead.
  • In all other cases, the queue manager ignores the field and uses the value MQOL_UNDEFINED instead.

This is an output field on the MQGET call.

The initial value of this field is MQOL_UNDEFINED. This field is ignored if Version is less than MQMD_VERSION_2.

Parent topic: Fields for MQMD