Examples of MQCONN calls

Examples of using MQCONN to connect to a specific queue manager, or to one of a group of queue managers.

In each of the following examples, the network is the same; there is a connection defined to two servers from the same IBM® MQ MQI client. (In these examples, the MQCONNX call could be used instead of the MQCONN call.)

There are two queue managers running on the server machines, one named SALE and the other named SALE_BACKUP.
Figure 1. MQCONN example
Client connected by two MQI channels to two queue managers: ALPHA to SALE, BETA to SALE_BACKUP.

The definitions for the channels in these examples are:

SALE definitions:

DEFINE CHANNEL(ALPHA) CHLTYPE(SVRCONN) TRPTYPE(TCP) +
DESCR('Server connection to IBM MQ MQI client')

DEFINE CHANNEL(ALPHA) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
CONNAME(9.20.4.26) DESCR('IBM MQ MQI client connection to server 1') +
QMNAME(SALE)

DEFINE CHANNEL(BETA) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
CONNAME(9.20.5.26) DESCR('IBM MQ MQI client connection to server 2') +
QMNAME(SALE)
SALE_BACKUP definition:

DEFINE CHANNEL(BETA) CHLTYPE(SVRCONN) TRPTYPE(TCP) +
DESCR('Server connection to IBM MQ MQI client')

The client channel definitions can be summarized as follows:

Name CHLTYPE TRPTYPE CONNAME QMNAME
ALPHA CLNTCONN TCP 9.20.4.26 SALE
BETA CLNTCONN TCP 9.20.5.26 SALE