The amqscnxc connect sample program

 


Overview

The amqscnxc program connects to a queue manager using the MQCONNX call, inquires about the name of the queue manager using the MQINQ call, and displays it.

To run...

amqscnxc [-x ConnName [-c SvrconnChannelName]] [QMgrName]

...where...

ConnName
TCP/IP connection name of the server queue manager

SvrconnChannelName
Name of the server connection channel

QMgrName
Name of the target queue manager

If you do not specify the TCP/IP connection name, MQCONNX is issued with the ClientConnPtr set to NULL. If you specify the TCP/IP connection name but not the server connection channel (the reverse is not allowed) the sample uses the name SYSTEM.DEF.SVRCONN. If you do not specify the target queue manager the sample connects to whichever queue manager is listening at the given TCP/IP connection name.

If you enter a question mark as the only parameter or if you enter incorrect parameters you will see a message explaining how to use the program.

If you run the sample with no command-line options the contents of the MQSERVER environment variable are used to determine the connection information. (In this example MQSERVER is set to "SYSTEM.DEF.SVRCONN/TCP/machine.site.company.com".) You see output like this:

Sample AMQSCNXC start
Connecting to the default queue manager
with no client connection information specified.
Connection established to queue manager machine
 
Sample AMQSCNXC end

If you run the sample and provide a TCP/IP connection name and a server connection channel name but no target queue manager name, like this:

amqscnxc -x machine.site.company.com -c SYSTEM.ADMIN.SVRCONN

the default queue manager name is used and you see output like this:

Sample AMQSCNXC start
Connecting to the default queue manager
using the server connection channel SYSTEM.ADMIN.SVRCONN
on connection name machine.site.company.com.
Connection established to queue manager MACHINE
 
Sample AMQSCNXC end

If you run the sample and provide a TCP/IP connection name and a target queue manager name, like this:

amqscnxc -x machine.site.company.com MACHINE

you see output like this:

Sample AMQSCNXC start
Connecting to queue manager MACHINE
using the server connection channel SYSTEM.DEF.SVRCONN
on connection name machine.site.company.com.
Connection established to queue manager MACHINE
 
Sample AMQSCNXC end