Options (MQLONG) for MQGMO
- Add the values (do not add the same constant more than once), or
- Combine the values using the bitwise OR operation (if the programming language supports bit operations).
Wait options
- MQGMO_WAIT
- The application waits until a suitable message arrives. The maximum time that the application
waits is specified in
WaitInterval.Important: There is no wait, or delay, if a suitable message is available immediately.If MQGET requests are inhibited, or MQGET requests become inhibited while waiting, the wait is canceled. The call completes with
MQCC_FAILEDand reason codeMQRC_GET_INHIBITED, regardless of whether there are suitable messages on the queue.You can use
MQGMO_WAITwith theorMQGMO_BROWSE_FIRSTMQGMO_BROWSE_NEXToptions.If several applications are waiting on the same shared queue, the following rules select which application is activated when a suitable message arrives:
If more than one MQGET call without a BROWSE option is waiting on the same queue, only one is activated. The queue manager attempts to give priority to waiting calls in the following order:Table 1. Rules for activating MQGET calls on a shared queue. Number of MQGET calls waiting to be activated Result With a BROWSE option Without a BROWSE option 1 None One or more One MQGET call without a BROWSE option is activated. One or more None All MQGET calls with a BROWSE option are activated. One or more One or more One MQGET call without a BROWSE option is activated. The number of MQGET calls with a BROWSE option that are activated is unpredictable. - Specific get-wait requests that can be satisfied only by certain messages, for example, ones
with a specific
MsgIdorCorrelId(or both). - General get-wait requests that can be satisfied by any message.
Note:- Within the first category, no additional priority is given to more specific get-wait requests.
For example, requests that specify both
MsgIdandCorrelId. - Within either category, it cannot be predicted which application is selected. In particular, the application waiting longest is not necessarily the one selected.
- Path length, and priority-scheduling considerations of the operating system, can mean that a waiting application of lower operating system priority than expected retrieves the message.
- It can also happen that an application that is not waiting retrieves the message in preference to one that is.
On z/OS®, the following points apply:- If you want the application to proceed with other work while waiting for the message to arrive,
consider using the signal option (
MQGMO_SET_SIGNAL) instead. However the signal option is environment-specific; applications that you to port between different environments must not use it. - If there is more than one MQGET call waiting for the same message, with a
mixture of wait and signal options, each waiting call is considered equally. It is an error to
specify
MQGMO_SET_SIGNALwithMQGMO_WAIT. It is also an error to specify this option with a queue handle for which a signal is outstanding. - If you specify
MQGMO_WAITorMQGMO_SET_SIGNALfor a queue that has anIndexTypeofMQIT_MSG_TOKEN, no selection criteria are permitted. This means that:- If you are using a version-1
MQGMO, set theMsgIdandCorrelIdfields in the MQMD specified on the MQGET call toMQMI_NONEandMQCI_NONE. - If you are using a version-2 or later
MQGMO, set theMatchOptionsfield toMQMO_NONE.
- If you are using a version-1
- For an MQGET call on a shared queue and the call is a browse request, or a
destructive get of a group message, and neither
MsgIdnorCorrelIdare to be matched, your signal ECB is posted MQEC_MSG_ARRIVED after 200 milliseconds.This occurs, even though a suitable message might not have arrived on the queue, until the wait interval has expired, when the queue is posted with MQEC_WAIT_INTERVAL_EXPIRED. When MQEC_MSG_ARRIVED is posted, you must reissue a second MQGET call to retrieve the message, if one is available.
This technique is used to ensure that you are informed in a timely manner of a message arrival, but can appear as an unexpected processing overhead when compared with a similar call sequence on a nonshared queue.
MQGMO_WAITis ignored if specified withMQGMO_BROWSE_MSG_UNDER_CURSORorMQGMO_MSG_UNDER_CURSOR; no error is raised. - Specific get-wait requests that can be satisfied only by certain messages, for example, ones
with a specific
- MQGMO_NO_WAIT
- The application does not wait if no suitable message is available.
MQGMO_NO_WAITis the opposite of theMQGMO_WAIT.MQGMO_NO_WAITis defined to aid program documentation. It is the default if neither is specified. - MQGMO_SET_SIGNAL
- Use this option with the
Signal1andSignal2fields. It allows applications to proceed with other work while waiting for a message to arrive. It also allows (if suitable operating system facilities are available) applications to wait for messages arriving on more than one queue.Note: TheMQGMO_SET_SIGNALoption is environment-specific; do not use it for applications that you want to port.In two circumstances, the call completes in the same way as if this option had not been specified:- If a currently available message satisfies the criteria specified in the message descriptor.
- If a parameter error or other synchronous error is detected.
If no message satisfying the criteria specified in the message descriptor is currently available, control returns to the application without waiting for a message to arrive. The CompCode and Reason parameters are set to
MQCC_WARNINGandMQRC_SIGNAL_REQUEST_ACCEPTED. Other output fields in the message descriptor and the output parameters of the MQGET call are not set. When a suitable message arrives later, the signal is delivered by posting the ECB.The caller must then reissue the MQGET call to retrieve the message. The application can wait for this signal, using functions provided by the operating system.
If the operating system provides a multiple wait mechanism, you can use it to wait for a message arriving on any one of several queues.
If a nonzero
WaitIntervalis specified, the signal is delivered after the wait interval expires. The queue manager can also cancel the wait, in which case the signal is delivered.More than one MQGET call can set a signal for the same message. The order in which applications are activated is the same as described for
MQGMO_WAIT.If more than one MQGET call is waiting for the same message, each waiting call is considered equally. The calls can include a mixture of wait and signal options.
Under certain conditions the MQGET call can retrieve a message, and a signal resulting from the arrival of the same message can be delivered. When a signal is delivered, an application must be prepared for no message to be available.
A queue handle can have no more than one signal request outstanding.
This option is not valid with any of the following options:MQGMO_UNLOCKMQGMO_WAIT
For an MQGET call on a shared queue and the call is a browse request, or a destructive get of a group message, and neither
MsgIdorCorrelIdare to be matched, the user's signal ECB is postedMQEC_MSG_ARRIVEDafter 200 milliseconds.This occurs, even though a suitable message might not have arrived on the queue, until the wait interval has expired, when the queue is posted with
MQEC_WAIT_INTERVAL_EXPIRED. WhenMQEC_MSG_ARRIVEDis posted, you must reissue a second MQGET call to retrieve the message, if one is available.This technique is used to ensure that you are informed in a timely manner of a message arrival, but can appear as an unexpected processing overhead when compared with a similar call sequence on a nonshared queue.
This is not an efficient method of message retrieval when messages are added infrequently. To avoid this overhead for the browse case, specify
MsgId(if non-indexed or indexed byMsgId) or CorrelId (if indexed byCorrelId) matching on the MQGET call.
This option is supported on z/OS
only. - MQGMO_FAIL_IF_QUIESCING
- Force the MQGET call to fail if the queue manager is in the quiescing state.
On z/OS, this option also forces
the MQGET call to fail if the connection (for a CICS® or IMS
application) is in the quiescing state. If this option is specified withMQGMO_WAITorMQGMO_SET_SIGNAL, and the wait or signal is outstanding at the time the queue manager enters the quiescing state:- The wait is canceled and the call returns completion code
MQCC_FAILEDwith reason codeMQRC_Q_MGR_QUIESCINGorMQRC_CONNECTION_QUIESCING. - The signal is canceled with an environment-specific signal completion code.
On
z/OS, the signal completes with event completion code
MQEC_Q_MGR_QUIESCINGorMQEC_CONNECTION_QUIESCING.
MQGMO_FAIL_IF_QUIESCINGis not specified and the queue manager or connection enters the quiescing state, the wait or signal is not canceled. - The wait is canceled and the call returns completion code
Sync point options
- MQGMO_SYNCPOINT
- The request is to operate within the normal unit-of-work protocols. The message is marked as
being unavailable to other applications, but it is deleted from the queue only when the unit of work
is committed. The message is made available again if the unit of work is backed out. You can leave
MQGMO_SYNCPOINTandMQGMO_NO_SYNCPOINTunset. In which case, the inclusion of the get request in unit-of-work protocols is determined by the environment running the queue manager. It is not determined by the environment running the application.
On z/OS, the get request is within
a unit of work. - In all environments except z/OS, the get request is not within a unit of work.
Because of these differences, an application that you want to port must not allow this option to default; specify
MQGMO_SYNCPOINTorMQGMO_NO_SYNCPOINTexplicitly.This option is not valid with any of the following options:MQGMO_BROWSE_FIRSTMQGMO_BROWSE_MSG_UNDER_CURSORMQGMO_BROWSE_NEXTMQGMO_LOCKMQGMO_NO_SYNCPOINTMQGMO_SYNCPOINT_IF_PERSISTENTMQGMO_UNLOCK
- MQGMO_SYNCPOINT_IF_PERSISTENT
- The request is to operate within the normal unit-of-work protocols, but only if the message
retrieved is persistent. A persistent message has the value
MQPER_PERSISTENTin thePersistencefield in MQMD.- If the message is persistent, the queue manager processes the call as though the application had
specified
MQGMO_SYNCPOINT. - If the message is not persistent, the queue manager processes the call as though the application
had specified
MQGMO_NO_SYNCPOINT.
This option is not valid with any of the following options:MQGMO_BROWSE_FIRSTMQGMO_BROWSE_MSG_UNDER_CURSORMQGMO_BROWSE_NEXTMQGMO_COMPLETE_MSGMQGMO_MARK_SKIP_BACKOUTMQGMO_NO_SYNCPOINTMQGMO_SYNCPOINTMQGMO_UNLOCK
This option is supported in the following environments:
AIX®
IBM® i
Linux®
z/OS
- If the message is persistent, the queue manager processes the call as though the application had
specified
- MQGMO_NO_SYNCPOINT
- The request is to operate outside the normal unit-of-work protocols. If you get a message
without a browse option, it is deleted from the queue immediately. The message cannot be made
available again by backing out the unit of work.
This option is assumed if you specify
MQGMO_BROWSE_FIRSTorMQGMO_BROWSE_NEXT.You can leaveMQGMO_SYNCPOINTandMQGMO_NO_SYNCPOINTunset. In which case, the inclusion of the get request in unit-of-work protocols is determined by the environment running the queue manager. It is not determined by the environment running the application.
On z/OS, the get request is within
a unit of work. - In all environments except z/OS, the get request is not within a unit of work.
Because of these differences, an application that you want to port must not allow this option to default; specify either
MQGMO_SYNCPOINTorMQGMO_NO_SYNCPOINTexplicitly.This option is not valid with any of the following options:MQGMO_MARK_SKIP_BACKOUTMQGMO_SYNCPOINTMQGMO_SYNCPOINT_IF_PERSISTENT
MQGMO_MARK_SKIP_BACKOUT- Back out a unit of work without reinstating on the queue the message that was marked with this option.
Browse options
- MQGMO_BROWSE_FIRST
- When a queue is opened with the MQOO_BROWSE option, a browse cursor is established, positioned
logically before the first message on the queue. You can then use MQGET calls
specifying the
MQGMO_BROWSE_FIRST,MQGMO_BROWSE_NEXT, orMQGMO_BROWSE_MSG_UNDER_CURSORoption to retrieve messages from the queue nondestructively. The browse cursor marks the position, within the messages on the queue, from which the next MQGET call withMQGMO_BROWSE_NEXTsearches for a suitable message.MQGMO_BROWSE_FIRSTis not valid with any of the following options:MQGMO_BROWSE_MSG_UNDER_CURSORMQGMO_BROWSE_NEXTMQGMO_MARK_SKIP_BACKOUTMQGMO_MSG_UNDER_CURSORMQGMO_SYNCPOINTMQGMO_SYNCPOINT_IF_PERSISTENTMQGMO_UNLOCK
An MQGET call with
MQGMO_BROWSE_FIRSTignores the previous position of the browse cursor. The first message on the queue that satisfies the conditions specified in the message descriptor is retrieved. The message remains on the queue, and the browse cursor is positioned on this message.After this call, the browse cursor is positioned on the message that has been returned. The message might be removed from the queue before the next MQGET call with
MQGMO_BROWSE_NEXTis issued. In this case, the browse cursor remains at the position in the queue that the message occupied, even though that position is now empty.Use the
MQGMO_MSG_UNDER_CURSORoption with a non-browse MQGET call, to remove the message from the queue.The browse cursor is not moved by a non-browse MQGET call, even if using the same
Hobjhandle. Nor is it moved by a browse MQGET call that returns a completion code ofMQCC_FAILED, or a reason code ofMQRC_TRUNCATED_MSG_FAILED.Specify the
MQGMO_LOCKoption with this option, to lock the message that is browsed.You can specify
MQGMO_BROWSE_FIRSTwith any valid combination of theMQGMO_*andMQMO_*options that control the processing of messages in groups and segments of logical messages.If you specify
MQGMO_LOGICAL_ORDER, the messages are browsed in logical order. If you omit that option, the messages are browsed in physical order. If you specifyMQGMO_BROWSE_FIRST, you can switch between logical order and physical order. Subsequent MQGET calls usingMQGMO_BROWSE_NEXTbrowse the queue in the same order as the most recent call that specifiedMQGMO_BROWSE_FIRSTfor the queue handle.The queue manager retains two sets of group and segment information for MQGET calls. The group and segment information for browse calls are retained separately from the information for calls that remove messages from the queue. If you specify
MQGMO_BROWSE_FIRST, the queue manager ignores the group and segment information for browsing. It scans the queue as though there were no current group and no current logical message. If the MQGET call is successful, completion codeMQCC_OKorMQCC_WARNING, the group and segment information for browsing is set to that of the message returned. If the call fails, the group and segment information remain the same as they were before the call. - MQGMO_BROWSE_NEXT
- Advance the browse cursor to the next message on the queue that satisfies the selection criteria specified on the MQGET call. The message is returned to the application, but remains on the queue.
- MQGMO_BROWSE_MSG_UNDER_CURSOR
- Retrieve the message pointed to by the browse cursor nondestructively, regardless of the
MQMO_*options specified in theMatchOptionsfield in MQGMO. - MQGMO_MSG_UNDER_CURSOR
- Retrieve the message pointed to by the browse cursor, regardless of the
MQMO_*options specified in theMatchOptionsfield in MQGMO. The message is removed from the queue.The message pointed to by the browse cursor is the one that was last retrieved using either the
MQGMO_BROWSE_FIRSTor theMQGMO_BROWSE_NEXToption.If
MQGMO_COMPLETE_MSGis specified withMQGMO_MSG_UNDER_CURSOR, the browse cursor must identify a message whoseOffsetfield in MQMD is zero. If this condition is not satisfied, the call fails with reason codeMQRC_INVALID_MSG_UNDER_CURSOR.This option is not valid with any of the following options:MQGMO_BROWSE_FIRSTMQGMO_BROWSE_MSG_UNDER_CURSORMQGMO_BROWSE_NEXTMQGMO_UNLOCK
- MQGMO_MARK_BROWSE_HANDLE
- The message that is returned by a successful MQGET, or identified by the
returned
MsgToken, is marked. The mark is specific to the object handle used in the call.The message is not removed from the queue.
MQGMO_MARK_BROWSE_HANDLEis valid only if one of the following options is also specified:MQGMO_BROWSE_FIRSTMQGMO_BROWSE_MSG_UNDER_CURSORMQGMO_BROWSE_NEXT
MQGMO_MARK_BROWSE_HANDLEis not valid with any of the following options:MQGMO_ALL_MSGS_AVAILABLEMQGMO_ALL_SEGMENTS_AVAILABLEMQGMO_COMPLETE_MSGMQGMO_LOCKMQGMO_LOGICAL_ORDERMQGMO_UNLOCK
The message remains in this state until one of the following events occurs:- The object handle concerned is closed, either normally or otherwise.
- The message is unmarked for this handle by a call to MQGET with the option
MQGMO_UNMARK_BROWSE_HANDLE. - The message is returned from a call to destructive MQGET, which completes
with
MQCC_OKorMQCC_WARNING. The message state remains changed even if the MQGET is later rolled-back. - The message expires.
- MQGMO_MARK_BROWSE_CO_OP
- The message that is returned by a successful MQGET, or identified by the
returned
MsgToken, is marked for all handles in the cooperating set.The cooperative level mark is in addition to any handle level mark that might have been set.
The message is not removed from the queue.
MQGMO_MARK_BROWSE_CO_OPis valid only if the object handle used was returned by a call to MQOPEN that specifiedMQOO_CO_OP. You must also specify one of the following MQGMO options:MQGMO_BROWSE_FIRSTMQGMO_BROWSE_MSG_UNDER_CURSORMQGMO_BROWSE_NEXT
This option is not valid with any of the following options:MQGMO_ALL_MSGS_AVAILABLEMQGMO_ALL_SEGMENTS_AVAILABLEMQGMO_COMPLETE_MSGMQGMO_LOCKMQGMO_LOGICAL_ORDERMQGMO_UNLOCK
If the message is already marked, and the option
MQGMO_UNMARKED_BROWSE_MSGis not specified, the call fails withMQCC_FAILEDand reason codeMQRC_MSG_MARKED_BROWSE_CO_OP.The message remains in this state until one of the following events occurs:- All object handles in the cooperating set are closed.
- The message is unmarked for cooperating browsers by a call to MQGET with the
option
MQGMO_UNMARK_BROWSE_CO_OP. - The message is automatically unmarked by the queue manager.
- The message is returned from a call to a non-browse MQGET. The message state remains changed even if the MQGET is later rolled-back.
- The message expires.
MQGMO_UNMARKED_BROWSE_MSG- A call to MQGET that specifies
MQGMO_UNMARKED_BROWSE_MSGreturns a message that is considered to be unmarked for its handle. It does not return a message if the message was marked for its handle. It also does not return the message if the queue was opened by a call to MQOPEN, with the optionMQOO_CO_OP, and the message has been marked by a member of the cooperating set.This option is not valid with any of the following options:MQGMO_ALL_MSGS_AVAILABLEMQGMO_ALL_SEGMENTS_AVAILABLEMQGMO_COMPLETE_MSGMQGMO_LOCKMQGMO_LOGICAL_ORDERMQGMO_UNLOCK
- MQGMO_UNMARK_BROWSE_CO_OP
- After a call to MQGET that specifies this option, the message is no longer
considered by any open handles in the set of cooperating handles to be marked for the cooperating
set. The message is still considered to be marked at handle level if it was marked at handle level
before this call.
Using
MQGMO_UNMARK_BROWSE_CO_OPis valid only with a handle returned by a successful call to MQOPEN with the optionMQOO_CO_OP. The MQGET succeeds even if the message is not considered to be marked by the cooperating set of handles.MQGMO_UNMARK_BROWSE_CO_OPis not valid on a non-browse MQGET call, or with any of the following options:MQGMO_ALL_MSGS_AVAILABLEMQGMO_ALL_SEGMENTS_AVAILABLEMQGMO_COMPLETE_MSGMQGMO_LOCKMQGMO_LOGICAL_ORDERMQGMO_MARK_BROWSE_CO_OPMQGMO_UNLOCKMQGMO_UNMARKED_BROWSE_MSG
- MQGMO_UNMARK_BROWSE_HANDLE
- After a call to MQGET that specifies this option, the message located is no
longer considered to be marked by this handle.
The call succeeds even if the message is not marked for this handle.
This option is not valid on a non-browse MQGET call, or with any of the following options:MQGMO_ALL_MSGS_AVAILABLEMQGMO_ALL_SEGMENTS_AVAILABLEMQGMO_COMPLETE_MSGMQGMO_LOCKMQGMO_LOGICAL_ORDERMQGMO_MARK_BROWSE_CO_OPMQGMO_UNLOCKMQGMO_UNMARKED_BROWSE_MSG
Lock options
- MQGMO_LOCK
- Lock the message that is browsed, so that the message becomes invisible to any other handle open
for the queue. The option can be specified only if one of the following options is also specified:
MQGMO_BROWSE_FIRSTMQGMO_BROWSE_NEXTMQGMO_BROWSE_MSG_UNDER_CURSOR
Only one message can be locked for each queue handle. The message can be a logical message or a physical message:- If you specify
MQGMO_COMPLETE_MSG, all the message segments that make up the logical message are locked to the queue handle. The messages must all be present on the queue and available for retrieval. - If you omit
MQGMO_COMPLETE_MSG, only a single physical message is locked to the queue handle. If this message happens to be a segment of a logical message, the locked segment prevents other applications usingMQGMO_COMPLETE_MSGto retrieve or browse the logical message.
The locked message is always the one under the browse cursor. The message can be removed from the queue by a later MQGET call that specifies the
MQGMO_MSG_UNDER_CURSORoption. Other MQGET calls using the queue handle can also remove the message (for example, a call that specifies the message identifier of the locked message).If the call returns completion code
MQCC_FAILED, orMQCC_WARNINGwith reason codeMQRC_TRUNCATED_MSG_FAILED, no message is locked.If the application does not remove the message from the queue, the lock is released by one of the following actions:- Issuing another MQGET call for this handle, specifying either
MQGMO_BROWSE_FIRSTorMQGMO_BROWSE_NEXT. The lock is released if the call completes withMQCC_OKorMQCC_WARNING. The message remains locked if the call completes withMQCC_FAILED. However, the following exceptions apply:- The message is not unlocked if
MQCC_WARNINGis returned withMQRC_TRUNCATED_MSG_FAILED. - The message is unlocked if
MQCC_FAILEDis returned withMQRC_NO_MSG_AVAILABLE.
If you also specify
MQGMO_LOCK, the message returned is locked. If you omitMQGMO_LOCK, there is no locked message after the call.If you specify
MQGMO_WAIT, and no message is immediately available, the original message is unlocked before the start of the wait. - The message is not unlocked if
- Issuing another MQGET call for this handle, with
MQGMO_BROWSE_MSG_UNDER_CURSOR, withoutMQGMO_LOCK. The lock is released if the call completes withMQCC_OKorMQCC_WARNING. The message remains locked if the call completes withMQCC_FAILED. However, the following exception applies:- The message is not unlocked if
MQCC_WARNINGis returned withMQRC_TRUNCATED_MSG_FAILED.
- The message is not unlocked if
- Issuing another MQGET call for this handle with
MQGMO_UNLOCK. - Issuing an MQCLOSE call using the handle. The MQCLOSE might be implicit, caused by the application ending.
MQGMO_LOCK, other thanMQOO_BROWSE, which is needed to specify an accompanying browse option.MQGMO_LOCKis not valid with any of the following options:MQGMO_MARK_SKIP_BACKOUTMQGMO_SYNCPOINTMQGMO_SYNCPOINT_IF_PERSISTENTMQGMO_UNLOCK
- MQGMO_UNLOCK
- The message to be unlocked must have been previously locked by an MQGET call
with the
MQGMO_LOCKoption. If there is no message locked for this handle, the call completes withMQCC_WARNINGandMQRC_NO_MSG_LOCKED.The MsgDesc, BufferLength, Buffer, and DataLength parameters are not checked or altered if you specify
MQGMO_UNLOCK. No message is returned inBuffer.No special open option is required to specify
MQGMO_UNLOCK(althoughMQOO_BROWSEis needed to issue the lock request in the first place).This option is not valid with any options except the following:MQGMO_NO_WAITMQGMO_NO_SYNCPOINT
Message-data options
- MQGMO_ACCEPT_TRUNCATED_MSG
- If the message buffer is too small to hold the complete message, allow the
MQGET call to fill the buffer. MQGET fills the buffer with as
much of the message it can. It issues a warning completion code, and completes its processing. This
means that:
- When browsing messages, the browse cursor is advanced to the returned message.
- When removing messages, the returned message is removed from the queue.
- Reason code MQRC_TRUNCATED_MSG_ACCEPTED is returned if no other error occurs.
- When browsing messages, the browse cursor is not advanced.
- When removing messages, the message is not removed from the queue.
- Reason code
MQRC_TRUNCATED_MSG_FAILEDis returned if no other error occurs.
- MQGMO_CONVERT
- This option converts the application data in the message to conform to the
CodedCharSetIdandEncodingvalues specified in the MsgDesc parameter on the MQGET call. The data is converted before it is copied to the Buffer parameter.TheFormatfield specified when the message was put is assumed by the conversion process to identify the nature of the data in the message. The message data is converted by the queue manager for built-in formats, and by a user-written exit for other formats. See Data-conversion exit for details of the data-conversion exit.- If conversion is successful, the
CodedCharSetIdandEncodingfields specified in the MsgDesc parameter are unchanged on return from the MQGET call. - If only conversion fails the message data is returned unconverted The
CodedCharSetIdandEncodingfields inMsgDescare set to the values for the unconverted message. The completion code isMQCC_WARNINGin this case.
See the
Formatfield described in MQMD - Message descriptor for a list of format names for which the queue manager performs the conversion. - If conversion is successful, the
Group and segment options
- Physical message
- A physical message is the smallest unit of information that can be placed on or removed from a
queue. It often corresponds to the information specified or retrieved on a single
MQPUT, MQPUT1, or MQGET call. Every
physical message has its own message descriptor, MQMD. Typically, physical messages
are distinguished by differing values for the message identifier, the
MsgIdfield in MQMD. The queue manager does not enforce different values. - Logical message
- A logical message is a single unit of application information. In the absence of system
constraints, a logical message is the same as a physical message. If logical messages are large,
system constraints might make it advisable or necessary to split a logical message into two or more
physical messages, called segments.
A logical message that has been segmented consists of two or more physical messages that have the same nonnull group identifier,
GroupIdfield in MQMD. They have the same message sequence number,MsgSeqNumberfield in MQMD. The segments are distinguished by differing values for the segment offset,Offsetfield in MQMD. The segment offset is the offset of the data in the physical message from the start of the data in the logical message. Because each segment is a physical message, the segments in a logical message typically have different message identifiers.A logical message that has not been segmented, but for which segmentation has been permitted by the sending application, also has a nonnull group identifier. In this case there is only one physical message with that group identifier if the logical message does not belong to a message group. Logical messages, for which segmentation has been inhibited by the sending application, have a null group identifier,
MQGI_NONE, unless the logical message belongs to a message group. - Message group
- A message group is a set of one or more logical messages that have the same nonnull group identifier. The logical messages in the group are distinguished by different values for the message sequence number. The sequence number is an integer in the range 1 through n, where n is the number of logical messages in the group. If one or more of the logical messages is segmented, there are more than n physical messages in the group.
- MQGMO_LOGICAL_ORDER
MQGMO_LOGICAL_ORDERcontrols the order in which messages are returned by successive MQGET calls for the queue handle. The option must be specified on each call.If
MQGMO_LOGICAL_ORDERis specified for successive MQGET calls for the same queue handle, messages in groups are returned in the order of their message sequence numbers. Segments of logical messages are returned in the order given by their segment offsets. This order might be different from the order in which those messages and segments occur on the queue.Note: SpecifyingMQGMO_LOGICAL_ORDERhas no adverse consequences on messages that do not belong to groups and that are not segments. In effect, such messages are treated as though each belonged to a message group consisting of only one message. It is safe to specifyMQGMO_LOGICAL_ORDERwhen retrieving messages from queues that contain a mixture of messages in groups, message segments, and unsegmented messages not in groups.To return the messages in the required order, the queue manager retains the group and segment information between successive MQGET calls. The group and segment information identifies the current message group and current logical message for the queue handle. It also identifies the current position within the group and logical message, and whether the messages are being retrieved within a unit of work. Because the queue manager retains this information, the application does not need to set the group and segment information before each MQGET call. Specifically, it means that the application does not need to set the
GroupId,MsgSeqNumber, andOffsetfields in MQMD. However, the application must set theMQGMO_SYNCPOINTorMQGMO_NO_SYNCPOINToption correctly on each call.When the queue is opened, there is no current message group and no current logical message. A message group becomes the current message group when a message that has theMQMF_MSG_IN_GROUPflag is returned by the MQGET call. WithMQGMO_LOGICAL_ORDERspecified on successive calls, that group remains the current group until a message is returned that has:MQMF_LAST_MSG_IN_GROUPwithoutMQMF_SEGMENT(that is, the last logical message in the group is not segmented), orMQMF_LAST_MSG_IN_GROUPwithMQMF_LAST_SEGMENT(that is, the message returned is the last segment of the last logical message in the group).
MQMF_SEGMENTflag is returned by the MQGET call. The logical message is terminated when the message that has theMQMF_LAST_SEGMENTflag is returned.If no selection criteria are specified, successive MQGET calls return, in the correct order, the messages for the first message group on the queue. They then return the messages for the second message group, and so on, until there are no more messages available. It is possible to select the particular message groups returned by specifying one or more of the following options in theMatchOptionsfield:MQMO_MATCH_MSG_IDMQMO_MATCH_CORREL_IDMQMO_MATCH_GROUP_ID
MatchOptionsfield described in MQGMO - Get-message options for further details.Table 2 shows the values of theMsgId,CorrelId,GroupId,MsgSeqNumber, andOffsetfields that the queue manager looks for when attempting to find a message to return on the MQGET call. The rules apply both to removing messages from the queue, and browsing messages on the queue. In the table, Either means Yes or No:-
LOG ORD - Indicates whether the
MQGMO_LOGICAL_ORDERoption is specified on the call. -
Cur grp - Indicates whether a current message group exists before the call.
-
Cur log msg - Indicates whether a current logical message exists before the call.
- Other columns
- Show the values that the queue manager looks for. Previous denotes the value returned for the field in the previous message for the queue handle.
Table 2. MQGET options relating to messages in groups and segments of logical messages Options you specify Group and log-msg status before call Values the queue manager looks for LOG ORDCur grpCur log msgMsgIdCorrelIdGroupIdMsgSeqNumberOffsetYes No No Controlled by MatchOptionsControlled by MatchOptionsControlled by MatchOptions1 0 Yes No Yes Any message identifier Any correlation identifier Previous group identifier 1 Previous offset + previous segment length Yes Yes No Any message identifier Any correlation identifier Previous group identifier Previous sequence number + 1 0 Yes Yes Yes Any message identifier Any correlation identifier Previous group identifier Previous sequence number Previous offset + previous segment length No Either Either Controlled by MatchOptionsControlled by MatchOptionsControlled by MatchOptionsControlled by MatchOptionsControlled by MatchOptionsIf multiple message groups are present on the queue and eligible for return, the groups are returned in the order determined by the position on the queue of the first segment of the first logical message in each group. That is, the physical messages that have message sequence numbers of 1, and offsets of 0, determine the order in which eligible groups are returned.
TheMQGMO_LOGICAL_ORDERoption affects units of work as follows:- If the first logical message or segment in a group is retrieved within a unit of work, all the other logical messages and segments in the group must be retrieved within a unit of work, if the same queue handle is used. However, they need not be retrieved within the same unit of work. This allows a message group consisting of many physical messages to be split across two or more consecutive units of work for the queue handle.
- If the first logical message or segment in a group is not retrieved within a unit of work, and the same queue handle is used, none of the other logical messages and segments in the group can be retrieved within a unit of work.
MQRC_INCONSISTENT_UOW.When
MQGMO_LOGICAL_ORDERis specified, the MQGMO supplied on the MQGET call must not be less thanMQGMO_VERSION_2, and the MQMD must not be less thanMQMD_VERSION_2. If this condition is not satisfied, the call fails with reason codeMQRC_WRONG_GMO_VERSIONorMQRC_WRONG_MD_VERSION, as appropriate.If
MQGMO_LOGICAL_ORDERis not specified for successive MQGET calls for the queue handle, messages are returned without regard for whether they belong to message groups, or whether they are segments of logical messages. This means that messages or segments from a particular group or logical message might be returned out of order, or intermingled with messages or segments from other groups or logical messages, or with messages that are not in groups and are not segments. In this situation, the particular messages that are returned by successive MQGET calls is controlled by theMQMO_*options specified on those calls (see theMatchOptionsfield described in MQGMO - Get-message options for details of these options).This is the technique that can be used to restart a message group or logical message in the middle, after a system failure has occurred. When the system restarts, the application can set the
GroupId,MsgSeqNumber,Offset, andMatchOptionsfields to the appropriate values, and then issue the MQGET call withMQGMO_SYNCPOINTorMQGMO_NO_SYNCPOINTset, but without specifyingMQGMO_LOGICAL_ORDER. If this call is successful, the queue manager retains the group and segment information, and subsequent MQGET calls using that queue handle can specifyMQGMO_LOGICAL_ORDERas normal.The group and segment information that the queue manager retains for the MQGET call is separate from the group and segment information that it retains for the MQPUT call. In addition, the queue manager retains separate information for:- MQGET calls that remove messages from the queue.
- MQGET calls that browse messages on the queue.
For any given queue handle, the application can mix MQGET calls that specifyMQGMO_LOGICAL_ORDERwith MQGET calls that do not. However, note the following points:- If you omit
MQGMO_LOGICAL_ORDER, each successful MQGET call causes the queue manager to set the saved group and segment information to the values corresponding to the message returned; this replaces the existing group and segment information retained by the queue manager for the queue handle. Only the information appropriate to the action of the call (browse or remove) is modified. - If you omit
MQGMO_LOGICAL_ORDER, the call does not fail if there is a current message group or logical message; the call might succeed with anMQCC_WARNINGcompletion code. Table 3 shows the various cases that can arise. In these cases, if the completion code is notMQCC_OK, the reason code is one of the following (as appropriate):MQRC_INCOMPLETE_GROUPMQRC_INCOMPLETE_MSGMQRC_INCONSISTENT_UOW
Note: The queue manager does not check the group and segment information when browsing a queue, or when closing a queue that was opened for browse but not input; in those cases the completion code is alwaysMQCC_OK(assuming no other errors).
Table 3. Outcome when MQGET or MQCLOSE call is not consistent with group and segment information Current call is Previous call was MQGET with MQGMO_LOGICAL_ORDERPrevious call was MQGET without MQGMO_LOGICAL_ORDERMQGET with MQGMO_LOGICAL_ORDERMQCC_FAILEDMQCC_FAILEDMQGET without MQGMO_LOGICAL_ORDERMQCC_WARNINGMQCC_OKMQCLOSE with an unterminated group or logical message MQCC_WARNINGMQCC_OKApplications that want to retrieve messages and segments in logical order are recommended to specify
MQGMO_LOGICAL_ORDER, as this is the simplest option to use. This option relieves the application of the need to manage the group and segment information, because the queue manager manages that information. However, specialized applications might need more control than that provided by theMQGMO_LOGICAL_ORDERoption, and this can be achieved by not specifying that option. The application must then ensure that theMsgId,CorrelId,GroupId,MsgSeqNumber, andOffsetfields in MQMD, and theMQMO_*options inMatchOptionsin MQGMO, are set correctly, before each MQGET call.For example, an application that wants to forward physical messages that it receives, without regard for whether those messages are in groups or segments of logical messages, must not specify
MQGMO_LOGICAL_ORDER. In a complex network with multiple paths between sending and receiving queue managers, the physical messages might arrive out of order. By specifying neitherMQGMO_LOGICAL_ORDER, nor the correspondingMQPMO_LOGICAL_ORDERon the MQPUT call, the forwarding application can retrieve and forward each physical message as soon as it arrives, without having to wait for the next one in logical order to arrive.You can specifyMQGMO_LOGICAL_ORDERwith any of the otherMQGMO_*options, and with various of theMQMO_*options in appropriate circumstances (see preceding section).
On z/OS, this option is supported
for private and shared queues, but the queue must have an index type of
MQIT_GROUP_ID. For shared queues, the CFSTRUCT object that the queue maps to must be at CFLEVEL(3) or higher.- This option is supported for all local queues for the following platforms:
AIX
Linux
IBM i
Windows
- MQGMO_COMPLETE_MSG
- Only a complete logical message can be returned by the MQGET call. If the
logical message is segmented, the queue manager reassembles the segments and returns the complete
logical message to the application; the fact that the logical message was segmented is not apparent
to the application retrieving it. Note: This is the only option that causes the queue manager to reassemble message segments. If not specified, segments are returned individually to the application if they are present on the queue (and they satisfy the other selection criteria specified on the MQGET call). Applications that do not want to receive individual segments must always specify
MQGMO_COMPLETE_MSG.To use this option, the application must provide a buffer that is big enough to accommodate the complete message, or specify the
MQGMO_ACCEPT_TRUNCATED_MSGoption.If the queue contains segmented messages with some of the segments missing (perhaps because they have been delayed in the network and have not yet arrived), specifying
MQGMO_COMPLETE_MSGprevents the retrieval of segments belonging to incomplete logical messages. However, those message segments still contribute to the value of the CurrentQDepth queue attribute; this means that there might be no retrievable logical messages, even thoughCurrentQDepthis greater than zero.For persistent messages, the queue manager can reassemble the segments only within a unit of work:- If the MQGET call is operating within a user-defined unit of work, that unit of work is used. If the call fails during the reassembly process, the queue manager reinstates on the queue any segments that were removed during reassembly. However, the failure does not prevent the unit of work being committed successfully.
- If the call is operating outside a user-defined unit of work, and there is no user-defined unit of work in existence, the queue manager creates a unit of work for the duration of the call. If the call is successful, the queue manager commits the unit of work automatically (the application does not need to do this). If the call fails, the queue manager backs out the unit of work.
- If the call is operating outside a user-defined unit of work, but a user-defined unit of work
exists, the queue manager cannot reassemble. If the message does not require reassembly, the call
can still succeed. But if the message requires reassembly, the call fails with reason code
MQRC_UOW_NOT_AVAILABLE.
For nonpersistent messages, the queue manager does not require a unit of work to be available to perform reassembly.
Each physical message that is a segment has its own message descriptor. For the segments constituting a single logical message, most of the fields in the message descriptor are the same for all segments in the logical message; typically it is only the
MsgId,Offset, andMsgFlagsfields that differ between segments in the logical message. However, if a segment is placed on a dead-letter queue at an intermediate queue manager, the DLQ handler retrieves the message specifying theMQGMO_CONVERToption, and this can result in the character set or encoding of the segment being changed. If the DLQ handler successfully sends the segment on its way, the segment might have a character set or encoding that differs from the other segments in the logical message when the segment arrives at the destination queue manager.A logical message consisting of segments in which the
CodedCharSetIdandEncodingfields differ cannot be reassembled by the queue manager into a single logical message. Instead, the queue manager reassembles and returns the first few consecutive segments at the start of the logical message that have the same character-set identifiers and encodings, and the MQGET call completes with completion codeMQCC_WARNINGand reason codeMQRC_INCONSISTENT_CCSIDSorMQRC_INCONSISTENT_ENCODINGS, as appropriate. This happens regardless of whetherMQGMO_CONVERTis specified. To retrieve the remaining segments, the application must reissue the MQGET call without theMQGMO_COMPLETE_MSGoption, retrieving the segments one by one.MQGMO_LOGICAL_ORDERcan be used to retrieve the remaining segments in order.An application that puts segments can also set other fields in the message descriptor to values that differ between segments. However, there is no advantage in doing this if the receiving application uses
MQGMO_COMPLETE_MSGto retrieve the logical message. When the queue manager reassembles a logical message, it returns in the message descriptor the values from the message descriptor for the first segment; the only exception is theMsgFlagsfield, which the queue manager sets to indicate that the reassembled message is the only segment.If
MQGMO_COMPLETE_MSGis specified for a report message, the queue manager performs special processing. The queue manager checks the queue to see if all the report messages of that report type relating to the different segments in the logical message are present on the queue. If they are, they can be retrieved as a single message by specifyingMQGMO_COMPLETE_MSG. For this to be possible, either the report messages must be generated by a queue manager or MCA which supports segmentation, or the originating application must request at least 100 bytes of message data (that is, the appropriateMQRO_*_WITH_DATAorMQRO_*_WITH_FULL_DATAoptions must be specified). If less than the full amount of application data is present for a segment, the missing bytes are replaced by nulls in the report message returned.If
MQGMO_COMPLETE_MSGis specified withMQGMO_MSG_UNDER_CURSORorMQGMO_BROWSE_MSG_UNDER_CURSOR, the browse cursor must be positioned on a message whoseOffsetfield in MQMD has a value of 0. If this condition is not satisfied, the call fails with reason codeMQRC_INVALID_MSG_UNDER_CURSOR.MQGMO_COMPLETE_MSGimpliesMQGMO_ALL_SEGMENTS_AVAILABLE, which need not therefore be specified.MQGMO_COMPLETE_MSGcan be specified with any of the otherMQGMO_*options apart fromMQGMO_SYNCPOINT_IF_PERSISTENT, and with any of theMQMO_*options apart from MQMO_MATCH_OFFSET.
On z/OS, this option is supported
for private and shared queues, but the queue must have an index type of MQIT_GROUP_ID. For shared
queues, the CFSTRUCT object that the queue map to must be at CFLEVEL(3) or higher. - On the following platforms:
AIX
IBM i
Linux
Windows
- MQGMO_ALL_MSGS_AVAILABLE
- Messages in a group become available for retrieval only when all messages in the group are
available. If the queue contains message groups with some of the messages missing (perhaps because
they have been delayed in the network and have not yet arrived), specifying
MQGMO_ALL_MSGS_AVAILABLEprevents retrieval of messages belonging to incomplete groups. However, those messages still contribute to the value of the CurrentQDepth queue attribute; this means that there may be no retrievable message groups, even thoughCurrentQDepthis greater than zero. If there are no other messages that are retrievable, reason codeMQRC_NO_MSG_AVAILABLEis returned after the specified wait interval (if any) has expired.The processing ofMQGMO_ALL_MSGS_AVAILABLEdepends on whetherMQGMO_LOGICAL_ORDERis also specified:- If both options are specified,
MQGMO_ALL_MSGS_AVAILABLEhas an effect only when there is no current group or logical message. If there is a current group or logical message,MQGMO_ALL_MSGS_AVAILABLEis ignored. This means thatMQGMO_ALL_MSGS_AVAILABLEcan remain on when processing messages in logical order. - If
MQGMO_ALL_MSGS_AVAILABLEis specified withoutMQGMO_LOGICAL_ORDER,MQGMO_ALL_MSGS_AVAILABLEalways has an effect. This means that the option must be turned off after the first message in the group has been removed from the queue, in order to be able to remove the remaining messages in the group.
Successful completion of an MQGET call specifying
MQGMO_ALL_MSGS_AVAILABLEmeans that at the time that the MQGET call was issued, all the messages in the group were on the queue. However, be aware that other applications can still remove messages from the group (the group is not locked to the application that retrieves the first message in the group).If you omit this option, messages belonging to groups can be retrieved even when the group is incomplete.
MQGMO_ALL_MSGS_AVAILABLEimpliesMQGMO_ALL_SEGMENTS_AVAILABLE, which need not therefore be specified.MQGMO_ALL_MSGS_AVAILABLEcan be specified with any of the otherMQGMO_*options, and with any of theMQMO_*options.
On z/OS, this option is supported
for private and shared queues, but the queue must have an index type of MQIT_GROUP_ID. For shared
queues, the CFSTRUCT object that the queue map to must be at CFLEVEL(3) or higher. - On the following platforms:
AIX
IBM i
Linux
Windows
- If both options are specified,
- MQGMO_ALL_SEGMENTS_AVAILABLE
- Segments in a logical message become available for retrieval only when all segments in the
logical message are available. If the queue contains segmented messages with some of the segments
missing (perhaps because they have been delayed in the network and have not yet arrived), specifying
MQGMO_ALL_SEGMENTS_AVAILABLEprevents retrieval of segments belonging to incomplete logical messages. However, those segments still contribute to the value of the CurrentQDepth queue attribute; this means that there might be no retrievable logical messages, even thoughCurrentQDepthis greater than zero. If there are no other messages that are retrievable, reason codeMQRC_NO_MSG_AVAILABLEis returned after the specified wait interval (if any) has expired.The processing ofMQGMO_ALL_SEGMENTS_AVAILABLEdepends on whetherMQGMO_LOGICAL_ORDERis also specified:- If both options are specified,
MQGMO_ALL_SEGMENTS_AVAILABLEhas an effect only when there is no current logical message. If there is a current logical message,MQGMO_ALL_SEGMENTS_AVAILABLEis ignored. This means thatMQGMO_ALL_SEGMENTS_AVAILABLEcan remain on when processing messages in logical order. - If
MQGMO_ALL_SEGMENTS_AVAILABLEis specified withoutMQGMO_LOGICAL_ORDER,MQGMO_ALL_SEGMENTS_AVAILABLEalways has an effect. This means that the option must be turned off after the first segment in the logical message has been removed from the queue, in order to be able to remove the remaining segments in the logical message.
If this option is not specified, message segments can be retrieved even when the logical message is incomplete.
While both
MQGMO_COMPLETE_MSGandMQGMO_ALL_SEGMENTS_AVAILABLErequire all segments to be available before any of them can be retrieved, the former returns the complete message, whereas the latter allows the segments to be retrieved one by one.If
MQGMO_ALL_SEGMENTS_AVAILABLEis specified for a report message, the queue manager checks the queue to see if there is at least one report message for each of the segments that make up the complete logical message. If there is, theMQGMO_ALL_SEGMENTS_AVAILABLEcondition is satisfied. However, the queue manager does not check the type of the report messages present, and so there might be a mixture of report types in the report messages relating to the segments of the logical message. As a result, the success ofMQGMO_ALL_SEGMENTS_AVAILABLEdoes not imply thatMQGMO_COMPLETE_MSGwill succeed. If there is a mixture of report types present for the segments of a particular logical message, those report messages must be retrieved one by one.You can specifyMQGMO_ALL_SEGMENTS_AVAILABLEwith any of the otherMQGMO_*options, and with any of theMQMO_*options.- On z/OS, this option is supported for private and shared queues, but the queue must have an index type of MQIT_GROUP_ID. For shared queues, the CFSTRUCT object that the queue map to must be at CFLEVEL(3) or higher.
- On the following platforms:
AIX
IBM i
Linux
Windows
- If both options are specified,
Property options
- MQGMO_PROPERTIES_AS_Q_DEF
-
Properties of the message, except those contained in the message descriptor (or extension) should be represented as defined by the PropertyControl queue attribute. If a
MsgHandleis provided this option is ignored and the properties of the message are available via theMsgHandle, unless the value of the PropertyControl queue attribute isMQPROP_FORCE_MQRFH2.This is the default action if no property options are specified.
MQGMO_PROPERTIES_IN_HANDLE-
Properties of the message should be made available via the
MsgHandle. If no message handle is provided the call fails with reasonMQRC_HMSG_ERROR.Note: If the message is later read by an application that does not create a message handle, the queue manager places any message properties into anMQRFH2structure. You might find that the presence of an unexpectedMQRFH2header disrupts the behavior of an existing application. MQGMO_NO_PROPERTIES-
No properties of the message, except those contained in the message descriptor (or extension) will be retrieved. If a
MsgHandleis provided it will be ignored. MQGMO_PROPERTIES_FORCE_MQRFH2-
Properties of the message, except those contained in the message descriptor (or extension) should be represented using
MQRFH2headers. This provides compatibility with earlier version for applications which are expecting to retrieve properties but are unable to be changed to use message handles. If aMsgHandleis provided it is ignored. MQGMO_PROPERTIES_COMPATIBILITY- If the message contains a property with a prefix of "mcd.",
"jms.", "usr.", or "mqext.", all message
properties are delivered to the application in an
MQRFH2header. Otherwise all properties of the message, except those contained in the message descriptor (or extension), are discarded and are no longer accessible to the application.
Default option
- MQGMO_NONE
- Use this value to indicate that no other options have been specified; all options assume their
default values.
MQGMO_NONEaids program documentation; it is not intended that this option be used with any other, but as its value is zero, such use cannot be detected.
The initial value of the Options field is MQGMO_NO_WAIT plus
MQGMO_PROPERTIES_AS_Q_DEF.