Creating a client-connection channel on the IBM MQ MQI client

We can define a client-connection channel on the client workstation using MQSERVER or using the MQCNO structure on an MQCONNX call.


Use MQSERVER

We can use the MQSERVER environment variable to specify a simple definition of a client-connection channel. It is simple in the sense that we can specify only a few attributes of the channel using this method.

  • Specify a simple channel definition on Windows as follows:
    SET MQSERVER=ChannelName/TransportType/ConnectionName
    
  • Specify a simple channel definition on UNIX and Linux systems as follows:
    export MQSERVER=ChannelName/TransportType/ConnectionName
    
  • Specify a simple channel definition on IBM® i systems as follows:
    ADDENVVAR ENVVAR(MQSERVER) VALUE('ChannelName/TransportType/ConnectionName')
    
where:

  • ChannelName must be the same name as defined on the server. It cannot contain a forward slash.
  • TransportType can be one of the following values, depending on your IBM MQ MQI client platform:

    • LU62
    • TCP
    • NETBIOS
    • SPX
    Note: On UNIX and Linux systems, the TransportType is case-sensitive and must be uppercase. An MQCONN or MQCONNX call returns 2058 if the TransportType is not recognized
  • ConnectionName is the name of the server as defined to the communications protocol (TransportType).
For example, on Windows:
SET MQSERVER=CHANNEL1/TCP/MCID66499
or, on UNIX and Linux systems:
export MQSERVER=CHANNEL1/TCP/'MCID66499'
Note: To change the TCP/IP port number, see MQSERVER.
Figure 1. Simple channel definition

Some more examples of simple channel definitions are as follows:

  • On Windows:
    SET MQSERVER=CHANNEL1/TCP/9.20.4.56
    SET MQSERVER=CHANNEL1/NETBIOS/BOX643
    
  • On UNIX and Linux systems:
    export MQSERVER=CHANNEL1/TCP/'9.20.4.56'
    export MQSERVER=CHANNEL1/LU62/BOX99
    
  • On IBM i:
    ADDENVVAR ENVVAR(MQSERVER) VALUE('CHANNEL1/TCP/9.20.4.56(1416)')
    

where BOX99 is the LU 6.2 ConnectionName.

On the IBM MQ MQI client, all MQCONN or MQCONNX requests then attempt to use the channel we have defined, unless the channel is overridden in an MQCD structure referenced from the MQCNO structure supplied to MQCONNX.

Note: For more information about the MQSERVER environment variable, see MQSERVER.


Use the MQCNO structure on an MQCONNX call

An IBM MQ MQI client application can use the connect options structure, MQCNO, on an MQCONNX call to reference a channel definition structure, MQCD, that contains the definition of a client-connection channel.

In this way, the client application can specify the ChannelName, TransportType, and ConnectionName attributes of a channel at run time, enabling the client application to connect to multiple server queue managers simultaneously.

Note that if you define a channel using the MQSERVER environment variable, it is not possible to specify the ChannelName, TransportType, and ConnectionName attributes at run time.

A client application can also specify attributes of a channel such as MaxMsgLength and SecurityExit. Specifying such attributes enables the client application to specify values for the attributes that are not the default values, and enables channel exit programs to be called at the client end of an MQI channel.

If a channel uses Transport Layer Security (TLS), a client application can also provide information relating to TLS in the MQCD structure. Additional information relating to TLS can be provided in the TLS configuration options structure, MQSCO, which is also referenced by the MQCNO structure on an MQCONNX call.

For more information about the MQCNO, MQCD, and MQSCO structures, see MQCNO, MQCD, and MQSCO.

Note: The sample program for MQCONNX is called amqscnxc. Another sample program called amqssslc demonstrates use of the MQSCO structure.