The MQBag class
The class, MQBag, is used to create MQBag objects as required. When instantiated, the MQBag class returns a new MQBag object reference.
Create a MQBag object in Visual Basic as follows:Dim mqbag As MQBag Set mqbag = New MQBag
MQBag Property
The properties of MQBag objects are explained in the following list:
MQBag methods
The methods of the MQBag objects are explained in the following list:
- Add method.
- AddInquiry method.
- Clear method.
- Execute method.
- FromMessage method.
- ItemType method.
- Remove method.
- Selector method.
- ToMessage method.
- Truncate method.
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:- Error number: composed of the IBM MQ reason code for the error detected and a COM facility code. The facility field, as standard for COM, indicates the area of responsibility for the error. For errors detected by IBM MQ it is always FACILITY_ITF.
- Error source: identifies the type and version of the object that detected the error. For errors detected during MQBag operations, the error source is always MQBag.MQBag1.
- Error description: the string giving the symbolic name for the IBM MQ reason code.
- ReasonCode = Err.Number - vbObjectError
If the MQBag Execute method sends a PCF message and a reply is received, the operation is considered successful although the command sent might have failed. In this case, the reply bag itself contains the completion and error reason codes as described in Definitions of the Programmable Command Formats.