Error handling

If an error is detected during an operation on an MQBag object, including those errors returned to the bag by an underlying MQAX or MQAI object, an error exception is raised. The MQBag class supports the COM ISupportErrorInfo interface so the following information is available to your error handling routine:

How you access the error information depends on your scripting language; for example, in Visual Basic the information is returned in the Err object and the WebSphere MQ reason code is obtained by subtracting the constant vbObjectError from Err.Number.

ReasonCode = Err.Number - vbObjectError

If the MQBag Execute message sends a PCF message and a reply is received, the operation is considered successful although the command sent may have failed. In this case, the reply bag itself contains the completion and error reason codes as described in WebSphere MQ Programmable Command Formats and Administration Interface.