Disconnecting programs from a queue manager using MQDISC

Use this information to learn about 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 breaks the connection using the MQDISC call, except:
  • On CICS® Transaction Server for z/OS® applications, where the call is optional unless MQCONNX was used and you want to drop the connection tag before the application ends.
  • On WebSphere® MQ for IBM® i where, when you sign off from the operating system, an implicit MQDISC call is made.

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 you use MQCONNX 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, 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 MQDISC.

When no MQDISC is issued

A standard, non-shared connection (Hconn) is cleaned up when the creating thread terminates. A shared connection is only implicitly backed out and disconnected when the whole process terminates. If the thread that created the shared Hconn terminates while 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 that has the authority to open or connect to a WebSphere MQ object closes 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.