Closing objects using the MQCLOSE call
To close an object, use the MQCLOSE call. If the object is a queue, note the following:
- You do not need to empty a temporary dynamic queue before you close it.
When you close a temporary dynamic queue, the queue is deleted, along with any messages that might still be on it. This is true even if there are uncommitted MQGET, MQPUT, or MQPUT1 calls outstanding against the queue.
- On WebSphere MQ for z/OS, if you have any MQGET requests with an MQGMO_SET_SIGNAL option outstanding for that queue, they are canceled.
- If you opened the queue using the MQOO_BROWSE option, your browse cursor is destroyed.
Closure is unrelated to syncpoint, so we can close queues before or after syncpoint.
As input to the MQCLOSE call, supply:
- A connection handle. Use the same connection handle used to open it, or alternatively, for CICS applications on z/OS™, we can specify the constant MQHC_DEF_HCONN (which has the value zero).
- The handle of the object that you want to close. Get this from the output of the MQOPEN call.
- MQCO_NONE in the Options field (unless you are closing a permanent dynamic queue).
- The control option to determine whether the queue manager should delete the queue even if there are still messages on it (when closing a permanent dynamic queue).
The output from MQCLOSE is:
- A completion code
- A reason code
- The object handle, reset to the value MQHO_UNUSABLE_HOBJ
Descriptions of the parameters of the MQCLOSE call are given in the Application Programming Reference.
Parent topic:
Opening and closing objects
fg12300_