Parameters

OptionsBag (MQHBAG) - input
Handle of the bag containing options that control the processing of the call. This is a reserved parameter; the value must be MQHB_NONE.
DataBag (MQHBAG) - input
The handle of the bag to convert.

If the bag contains an administration message and mqAddInquiry was used to insert values into the bag, the value of the MQIASY_COMMAND data item must be an INQUIRE command that is recognized by the MQAI; MQRC_INQUIRY_COMMAND_ERROR results if it is not.

If the bag contains nested system bags, MQRC_NESTED_BAG_NOT_SUPPORTED results.

BufferLength (MQLONG) - input
Length in bytes of the buffer supplied.

If the buffer is too small to accommodate the message generated, MQRC_BUFFER_LENGTH_ERROR results.

Buffer (MQBYTE × BufferLength) - output
The buffer to hold the message.
DataLength (MQLONG) - output
The length in bytes of the buffer required to hold the entire bag. If the buffer is not long enough, the contents of the buffer are undefined but the DataLength is returned.

CompCode (MQLONG) - output
Completion code.

Reason (MQLONG) - output
Reason code qualifying CompCode.

The following reason codes indicating error conditions can be returned from the mqBagToBuffer call:

MQRC_BAG_WRONG_TYPE
Input data bag is a group bag.
MQRC_BUFFER_ERROR
Buffer parameter not valid (invalid parameter address or buffer not accessible).
MQRC_BUFFER_LENGTH_ERROR
Buffer length not valid or buffer too small. (Required length returned in DataLength.)
MQRC_DATA_LENGTH_ERROR
DataLength parameter not valid (invalid parameter address).
MQRC_HBAG_ERROR
Bag handle not valid.
MQRC_INQUIRY_COMMAND_ERROR
mqAddInquiry used with a command code that is not recognized as an INQUIRE command.
MQRC_NESTED_BAG_NOT_SUPPORTED
Input data bag contains one or more nested system bags.
MQRC_OPTIONS_ERROR
Options bag contains unsupported data items or a supported option has an invalid value.
MQRC_PARAMETER_MISSING
An administration message requires a parameter that is not present in the bag.
Note:
This reason code occurs for bags created with the MQCBO_ADMIN_BAG or MQCBO_REORDER_AS_REQUIRED options only.
MQRC_SELECTOR_WRONG_TYPE
mqAddString or mqSetString was used to add the MQIACF_INQUIRY selector to the bag.
MQRC_STORAGE_NOT_AVAILABLE
Insufficient storage available.