Use the MQRMH and MQMD structures
See the Application Programming Reference for a description of the fields in the reference message header and the message descriptor.
In the MQMD structure, set the Format field to MQFMT_REF_MSG_HEADER. The MQHREF format, when requested on MQGET, is converted automatically by WebSphere MQ along with any bulk data that follows.
Here is an example of the use of the DataLogicalOffset and DataLogicalLength fields of the MQRMH:
A putting application might put a reference message with:
- No physical data
- DataLogicalLength = 0 (this message represents the entire object)
- DataLogicalOffset = 0.
Assuming that the object is 70 000 bytes long, the sending message exit sends the first 40 000 bytes along the channel in a reference message containing:
- 40 000 bytes of physical data following the MQRMH
- DataLogicalLength = 40000
- DataLogicalOffset = 0 (from the start of the object).
It then places another message on the transmission queue containing:
- No physical data
- DataLogicalLength = 0 (to the end of the object). You could specify a value of 30 000 here.
- DataLogicalOffset = 40000 (starting from this point).
When this message exit is seen by the sending message exit, the remaining 30,000 bytes of data is appended, and the fields are set to:
- 30,000 bytes of physical data following the MQRMH
- DataLogicalLength = 30000
- DataLogicalOffset = 40000 (starting from this point).
The MQRMHF_LAST flag is also set.
For a description of the sample programs provided for the use of reference messages, see Sample programs (all platforms except z/OS).
Parent topic:
Reference messages
fg12750_