If you’re familiar with the IBM MQ for z/OS product, you may have issued the DISPLAY DQM command which gives you the following output:
CSQX830I M901 CSQXRDQM Channel initiator active
CSQX831I M901 CSQXRDQM 8 adapter subtasks started, 8 requested
CSQX832I M901 CSQXRDQM 5 dispatchers started, 5 requested
CSQX833I M901 CSQXRDQM 0 SSL server subtasks started, 0 requested
CSQX840I M901 CSQXRDQM 5 channels current, maximum 200
CSQX841I M901 CSQXRDQM 4 channels active, maximum 200, including 0 paused
CSQX842I M901 CSQXRDQM 0 channels starting, 1 stopped, 0 retrying
CSQX836I M901 CSQXRDQM Maximum channels - TCP/IP 200, LU 6.2 200
CSQX845I M901 CSQXRDQM TCP/IP system name is TCPIP
CSQX846I M901 CSQXRDQM TCP/IP listener INDISP=QMGR started, for port 1591 address *
CSQX849I M901 CSQXRDQM LU 6.2 listener INDISP=QMGR not started
There is no equivalent command for a distributed queue manager, however, you can get most of the same information from various other commands. So we have created an MQSCX script to create an equivalent set of output for a distributed queue manager.
Clearly some of the information simply doesn’t apply to distributed queue managers; for example the number of adapter, dispatcher and SSL Server subtasks. Also the TCP/IP system name doesn’t really have an equivalent on a distributed platform – or at least certainly not one that can be retrieved from the command server. The equivalents of DISPLAY QMGR MAXCHL ACTCHL TCPCHL LU62CHL is to look in the queue manager’s qm.ini file for MaxChannels and MaxActiveChannels on distributed, which is something that cannot work unless you are running the script local to the queue manager.
So the script issues the various commands required to get the information and then prints out a set of equivalent looking lines to give you a similar output:
MQG1 Channel initiator active
MQG1 14 channels current, maximum 400
MQG1 12 channels active, maximum 400, including 0 paused
MQG1 0 channels starting, 1 stopped, 1 retrying
MQG1 TCP/IP listener TCP.LSTR started, for port 1701 address *
MQG1 LU6.2 listener not started
It starts by checking whether the Channel initiator is active, which for most people will be since it gets started automatically by the queue manager these days.
DISPLAY QMSTATUS CHINIT
if (CHINIT = "RUNNING")
print _qmgr,'Channel initiator active'
Then it looks in the qm.ini file (but only if you’re not connected by a client or via connection). MQSCX can read environment variables just as if they were user variables, so it can make use of the MQ environment variable MQ_DATA_PATH which is setup by setmqenv. The _client system variable is new in MQSCX V9.0.0.
if (!(_client | (_connqmgr != _qmgr)))
@filename = @MQ_DATA_PATH+"/qmgrs/"+_qmgr+"/qm.ini"
@hf = fopen(@filename,"r")
while (fgets(@hf,@line) >= 0)
For each line in the qm.ini file it will check for MaxChannels and MaxActiveChannels.
if (findstri(@line, "MaxChannels") > 0)
@offset = findstr(@line, "=")
if (@offset > 0)
@MaxChannelsStr = substr(@line,@offset+1,strlen(@line)-@offset)
@MaxChannels = eval(@MaxChannelsStr)
A simple foreach loop allows the script to total up the number of different channel states currently on show. This then allows the various channel status lines in the output to be printed.
Finally the script has another simple foreach loop for listeners which also makes use of the new _numEach system variable to detect if the loop has never been called.
foreach(DISPLAY LSSTATUS(*) ALL WHERE(TRPTYPE EQ TCP))
print _qmgr, 'TCP/IP listener', LISTENER ,'started, for port', PORT, 'address', IPADDR
if (_numEach = 0)
print _qmgr, 'TCP/IP listener not started'
The complete function is available to download in our Example Scripts bundle.
If you’re not a current licence holder, and you’d like to try out MQSCX, please email email@example.com to request a trial licence.