Chapter 7. Connecting and disconnecting a queue manager

To use WebSphere MQ programming services, a program must have a connection to a queue manager. The way this connection is made depends on the platform and the environment in which the program is operating:

z/OS batch, WebSphere MQ for iSeries, MQSeries for OS/2 Warp, MQSeries for Compaq NonStop Kernel, WebSphere MQ on UNIX systems and WebSphere MQ for Windows
Programs that run in these environments can use the MQCONN MQI call to connect to, and the MQDISC call to disconnect from, a queue manager. Alternatively, on all but MQSeries for Compaq NonStop Kernel, programs can use the MQCONNX call. This chapter describes how writers of such programs should use these calls.

z/OS batch programs can connect, consecutively or concurrently, to multiple queue managers on the same TCB.

IMS
The IMS control region is connected to one or more queue managers when it starts. This connection is controlled by IMS commands. (For information on how to control the IMS adapter of WebSphere MQ for z/OS, see WebSphere MQ for z/OS System Administration Guide.) However, writers of message queuing IMS programs must use the MQCONN MQI call to specify the queue manager to which they want to connect. They can use the MQDISC call to disconnect from that queue manager. This chapter describes how writers of such programs should use these calls. Before the IMS adapter processes a message for another user following a Get Unique call from the IOPCB, or one implied by a checkpoint call, the adapter ensures that the application closes handles and disconnects from the queue manager.

IMS programs can connect, consecutively or concurrently, to multiple queue managers on the same TCB.

CICS Transaction Server for z/OS and CICS for MVS/ESA
CICS programs do not need to do any work to connect to a queue manager because the CICS system itself is connected. This connection is usually made automatically at initialization, but you can also use the CQKC transaction, which is supplied with WebSphere MQ for z/OS. CQKC is discussed in WebSphere MQ for z/OS System Administration Guide.

CICS tasks can connect only to the queue manager to which the CICS region, itself, is connected.

Note:
CICS programs can also use the MQI connect and disconnect calls (MQCONN and MQDISC). You may want to do this so that you can port these applications to non-CICS environments with a minimum of recoding. Be warned, though, that these calls always complete successfully in a CICS environment. This means that the return code may not reflect the true state of the connection to the queue manager.

TXSeries for Windows NT and Open Systems
These programs do not need to do any work to connect to a queue manager because the CICS system itself is connected. Therefore, only one connection at a time is supported. CICS applications must issue an MQCONN call to obtain a connection handle, and should issue an MQDISC call before they exit.

MQSeries for VSE/ESA
In your VSE/ESA application, make an explicit call to MQCONN to establish a connection to the VSE/ESA queue manager. Ensure that your application issues an MQDISC call to disconnect. The performance of your application is better if you connect and disconnect as infrequently as possible.

This chapter introduces connecting to and disconnecting from a queue manager, under these headings:



© IBM Corporation 1993, 2002. All Rights Reserved