Closing objects using the MQCLOSE call

 


To close an object, you use the MQCLOSE call. If the object is a queue, note the following:

  • There is no 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 may still be on it. This is true even if there are uncommitted MQGET, MQPUT, or MQPUT1 calls outstanding against the queue.

  • In 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.

Namelists can be closed only on AIX, HP-UX, OS/2, Linux, z/OS, OS/400, Solaris, Compaq Tru64 UNIX, and Windows systems.

In MQSeries for VSE/ESA, ensure that your application issues a matching MQCLOSE call for each MQOPEN call. If your application does not issue the MQCLOSE call, the MQSeries for VSE/ESA housekeeping routine issues the MQCLOSE call on its behalf and unwanted messages appear in the SYSTEM.LOG queue.

Closure is unrelated to syncpoint, so you 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, you can specify the constant MQHC_DEF_HCONN (which has the value zero).

  • The handle of the object 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 WebSphere MQ Application Programming Reference.

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.