Parameters

Hconn (MQHCONN) - input
MQI connection handle.
Hobj (MQHOBJ) - input
Object handle of the queue from which the message is to be retrieved. This handle was returned by a preceding MQOPEN call issued by the application. The queue must be open for input.
MsgDesc (MQMD) - input/output
Message descriptor (for more information, see the WebSphere MQ Application Programming Reference).

If the Format field in the message has a value other than MQFMT_ADMIN, MQFMT_EVENT, or MQFMT_PCF, MQRC_FORMAT_NOT_SUPPORTED results.

If, on entry to the call, the Encoding field in the application's MQMD has a value other than MQENC_NATIVE and MQGMO_CONVERT is specified, MQRC_ENCODING_NOT_SUPPORTED results. Also, if MQGMO_CONVERT is not specified, the value of the Encoding parameter must be the retrieving application's MQENC_NATIVE; if not, again MQRC_ENCODING_NOT_SUPPORTED results.

GetMsgOpts (MQGMO) - input/output
Get-message options (for more information, see the WebSphere MQ Application Programming Guide).

MQGMO_ACCEPT_TRUNCATED_MSG cannot be specified; MQRC_OPTIONS_ERROR results if it is. MQGMO_LOCK and MQGMO_UNLOCK are not supported in a 16-bit or 32-bit Window environment. MQGMO_SET_SIGNAL is supported in a 32-bit Window environment only.

Bag (MQHBAG) - input/output
Handle of a bag into which the retrieved message is placed. The MQAI performs an mqClearBag call on the bag before placing the message in the bag.
MQHB_NONE
Gets the retrieved message. This provides a means of deleting messages from the queue.

If an option of MQGMO_BROWSE_* is specified, this value sets the browse cursor to the selected message; it is not deleted in this case.

CompCode (MQLONG) - output
Completion code.

Reason (MQLONG) - output
Reason code qualifying CompCode.

The following reason codes indicating warning and error conditions can be returned from the mqGetBag call:

MQRC_*
Anything from the MQGET call or bag manipulation.
MQRC_BAG_CONVERSION_ERROR
Data could not be converted into a bag.

This indicates a problem with the format of the data to be converted into a bag (for example, the message is not a valid PCF).

If the message was retrieved destructively from the queue (that is, not browsing the queue), this reason code indicates that it has been discarded.

MQRC_BAG_WRONG_TYPE
Input data bag is a group bag.
MQRC_ENCODING_NOT_SUPPORTED
Encoding not supported; the value in the Encoding field of the MQMD must be MQENC_NATIVE.
MQRC_FORMAT_NOT_SUPPORTED
Format not supported; the Format name in the message is not MQFMT_ADMIN, MQFMT_EVENT, or MQFMT_PCF. If the message was retrieved destructively from the queue (that is, not browsing the queue), this reason code indicates that it has been discarded.
MQRC_HBAG_ERROR
Bag handle not valid.
MQRC_INCONSISTENT_ITEM_TYPE
Datatype of second occurrence of selector differs from datatype of first occurrence.
MQRC_SELECTOR_OUT_OF_RANGE
Selector not within valid range for call.
MQRC_STORAGE_NOT_AVAILABLE
Insufficient storage available.
MQRC_SYSTEM_BAG_NOT_ALTERABLE
System bag cannot be altered or deleted.