Not supported in WebSphere MQ for z/OS.
Increasing the maximum message length as discussed in topic Increasing the maximum message length has some negative implications. Also, it can still result in the message being too large for the queue or queue manager. In these cases, you can segment a message. For information about segments, see Message groups.
The next sections look at common uses for segmenting messages. For putting and destructively getting, it is assumed that the MQPUT or MQGET calls always operate within a unit of work. We strongly recommend that you always use this technique, to reduce the possibility of incomplete groups being present in the network. Single-phase commit by the queue manager is assumed, but of course other coordination techniques are equally valid.
Also, in the getting applications, it is assumed that if multiple servers are processing the same queue, each server executes similar code, so that one server never fails to find a message or segment that it expects to be there (because it had specified MQGMO_ALL_MSGS_AVAILABLE or MQGMO_ALL_SEGMENTS_AVAILABLE earlier).
This is the simplest scenario, in which one application puts a message to be retrieved by another. The message might be large: not too large for either the putting or the getting application to handle in a single buffer, but too large for the queue manager or a queue on which the message is to be put.
The only changes necessary for these applications are for the putting application to authorize the queue manager to perform segmentation if necessary:
PMO.Options = (existing options) MQPUT MD.MsgFlags = MQMF_SEGMENTATION_ALLOWED
and for the getting application to ask the queue manager to reassemble the message if it has been segmented:
GMO.Options = MQGMO_COMPLETE_MSG | (existing options) MQGET
The application buffer must be large enough to contain the reassembled message (unless you include the MQGMO_ACCEPT_TRUNCATED_MSG option).
If data conversion is necessary, the getting application might have to do it by specifying MQGMO_CONVERT. This should be straightforward because the data conversion exit is presented with the complete message. Do not attempt to convert data in a sender channel if the message is segmented, and the format of the data is such that the data-conversion exit cannot carry out the conversion on incomplete data.
Application segmentation is used for two main reasons:
However, if data conversion is not an issue, or if the getting application always uses MQGMO_COMPLETE_MSG, queue-manager segmentation can also be allowed by specifying MQMF_SEGMENTATION_ALLOWED. In our example, the application segments the message into four segments:
PMO.Options = MQPMO_LOGICAL_ORDER | MQPMO_SYNCPOINT MQPUT MD.MsgFlags = MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_LAST_SEGMENT MQCMIT
If you do not use MQPMO_LOGICAL_ORDER, the application must set the Offset and the length of each segment. In this case, logical state is not maintained automatically.
The getting application cannot guarantee to have a buffer large enough to hold any reassembled message. It must therefore be prepared to process segments individually.
For messages that are segmented, this application does not want to start processing one segment until all the segments that constitute the logical message are present. MQGMO_ALL_SEGMENTS_AVAILABLE is therefore specified for the first segment. If you specify MQGMO_LOGICAL_ORDER and there is a current logical message, MQGMO_ALL_SEGMENTS_AVAILABLE is ignored.
Once the first segment of a logical message has been retrieved, use MQGMO_LOGICAL_ORDER to ensure that the remaining segments of the logical message are retrieved in order.
No consideration is given to messages within different groups. If such messages occur, they are processed in the order in which the first segment of each message appears on the queue.
GMO.Options = MQGMO_SYNCPOINT | MQGMO_LOGICAL_ORDER | MQGMO_ALL_SEGMENTS_AVAILABLE | MQGMO_WAIT do while ( SegmentStatus == MQSS_SEGMENT ) MQGET /* Process each remaining segment of the logical message */ ... MQCMIT
The messages must be maintained in logical order in a group, and some or all of them might be so large that they require application segmentation.
In our example, a group of four logical messages is to be put. All but the third message are large, and require segmentation, which is performed by the putting application:
PMO.Options = MQPMO_LOGICAL_ORDER | MQPMO_SYNCPOINT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_LAST_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP | MQMF_LAST_SEGMENT MQPUT MD.MsgFlags = MQMF_MSG_IN_GROUP MQPUT MD.MsgFlags = MQMF_LAST_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_LAST_MSG_IN_GROUP | MQMF_SEGMENT MQPUT MD.MsgFlags = MQMF_LAST_MSG_IN_GROUP | MQMF_LAST_SEGMENT MQCMIT
In the getting application, MQGMO_ALL_MSGS_AVAILABLE is specified on the first MQGET. This means that no messages or segments of a group are retrieved until the entire group is available. When the first physical message of a group has been retrieved, MQGMO_LOGICAL_ORDER is used to ensure that the segments and messages of the group are retrieved in order:
GMO.Options = MQGMO_SYNCPOINT | MQGMO_LOGICAL_ORDER | MQGMO_ALL_MESSAGES_AVAILABLE | MQGMO_WAIT do while ( (GroupStatus != MQGS_LAST_MSG_IN_GROUP) || (SegmentStatus != MQGS_LAST_SEGMENT) ) MQGET /* Process a segment or complete logical message. Use the GroupStatus and SegmentStatus information to see what has been returned */ ... MQCMIT
You can put and get a segmented message that spans a unit of work in a similar way to Putting and getting a group that spans units of work.
You cannot, however, put or get segmented messages in a global unit of work.
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
part |