Disconnecting programs from a queue manager using MQDISC

When a program that has connected to a queue manager using the MQCONN or MQCONNX call has finished all interaction with the queue manager, it should break the connection using the MQDISC call. However, note that

As input to the MQDISC call, you must supply the connection handle (Hconn) that was returned by MQCONN or MQCONNX when you connected to the queue manager.

Except on CICS on z/OS, after MQDISC is called the connection handle (Hconn) is no longer valid, and you cannot issue any further MQI calls until you call MQCONN or MQCONNX again. MQDISC does an implicit MQCLOSE for any objects that are still open using this handle.

If MQCONNX was used to connect on WebSphere MQ for z/OS, MQDISC also ends the scope of the connection tag established by the MQCONNX. However, in a CICS, IMS, or RRS application, if there is an active unit of recovery associated with a connection tag, then the MQDISC is rejected with a reason code of MQRC_CONN_TAG_NOT_RELEASED.

Descriptions of the parameters are given in the description of the MQDISC call in WebSphere MQ Application Programming Reference.

When no MQDISC is issued

A standard, non-shared connection (Hconn) is cleaned up when the creating thread terminates. A shared connection will only be implicitly backed out and disconnected when the whole process terminates. If the thread that created the shared Hconn terminates whilst the Hconn still exists the Hconn is still useable.

Authority checking

The MQCLOSE and MQDISC calls usually perform no authority checking. In the normal course of events a job which has the authority to open or connect to a WebSphere MQ object will close or disconnect from that object. Even if the authority of a job that has connected to, or opened a WebSphere MQ object is revoked, the MQCLOSE and MQDISC calls are accepted.



© IBM Corporation 1993, 2002. All Rights Reserved