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
- On CICS Transaction Server for z/OS applications, the call is optional unless MQCONNX was used and you want to drop the connection tag before the application ends.
- On WebSphere MQ for iSeries, when you sign off from the operating system, an implicit MQDISC call is made.
- On MQSeries for VSE/ESA, if your application does not issue the MQDISC call explicitly, the MQSeries for VSE/ESA housekeeping routine issues the MQDISC call on its behalf and unwanted messages appear in the SYSTEM.LOG queue.
As input to the MQDISC call, 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 usable.
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.
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.