I first learned MQ quite a few years ago, back in the days of MQSeries version 5.1. The instructor on my MQ course told us that the most useful thing we could learn for administering MQ would be the command interface – the runmqsc program. Why? Simple: it is consistent between platforms[1]; it is scriptable; and it is extremely powerful, exposing everything you might want to know about how your queue manager is running.

In version 6 of WebSphere MQ, the command program has been considerably enhanced. If you’ve been used to the range of commands available in WebSphere MQ 5.3 or earlier, it is worth looking again the functions that are available. If you are new to the product, it is also worth knowing how to get the most from runmqsc.

This post is not going to be a full tutorial on using runmqsc. I just wanted to highlight some of the things that are possible in WMQ v6. In fact, I’m just going to focus on what we can learn using the DISPLAY command – some “did you know?”-style tips. For full reference information, check out the Infocenter.

First of all, let’s remind ourselves which objects we have access to:

AMQ8426: Valid MQSC commands are:
    DISPLAY AUTHINFO
    DISPLAY CHANNEL
    DISPLAY CHSTATUS
    DISPLAY CLUSQMGR
    DISPLAY PROCESS
    DISPLAY NAMELIST
    DISPLAY QALIAS
    DISPLAY QCLUSTER
    DISPLAY QLOCAL
    DISPLAY QMGR
    DISPLAY QMODEL
    DISPLAY QREMOTE
    DISPLAY QUEUE
    DISPLAY QSTATUS
    DISPLAY CONN
    DISPLAY SERVICE
    DISPLAY LISTENER
    DISPLAY SVSTATUS
    DISPLAY LSSTATUS
    DISPLAY QMSTATUS

There are a number of objects here that were not available in version 5.3, and others which have been extended. Again, see the Infocenter for more detail on what is new.

To check on the state of the queue manager itself, let’s take a look at the last of the objects on that list.

dis qmstatus all
     7 : dis qmstatus all
AMQ8705: Display Queue Manager Status Details.
   QMNAME(TEST_QM)                         STATUS(RUNNING)
   CONNS(7)                                CMDSERV(RUNNING)
   CHINIT(RUNNING)

Here we can see that there are 7 open connections to the queue manager, the command server is running, and the channel initiator is running. Handy. Saves a lot of effort with the ps and grep commands.

The QSTATUS object has been around since version 5.3. It allows us to check the status of one of our local queues. In version 6, more information is available.

dis qstatus (XML)
     8 : dis qstatus (XML)
AMQ8450: Display queue status details.
   QUEUE(XML)                              TYPE(QUEUE)
   CURDEPTH(3)                             IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MONQ(OFF)                               MSGAGE( )
   OPPROCS(1)                              QTIME( ,  )
   UNCOM(NO)

This is a nice summary of the local queue – we can immediately see the depth and number of processes attached to the queue. If monitoring is enabled, we also get to see information like the age of the oldest message on the queue (MSGAGE), when the last message was put or get (LPUTTIME and LGETTIME), and so on.

Here’s another useful object that was introduced in version 6: CONN. This holds information about each of the connections that are open on the queue manager.

dis conn(*)
    12 : dis conn(*)
AMQ8276: Display Connection details.
CONN(D4E4634620000101)
   EXTCONN(414D51434C4142325F514D2020202020)
   TYPE(CONN)
AMQ8276: Display Connection details.
CONN(D4E4634620000201)
   EXTCONN(414D51434C4142325F514D2020202020)
   TYPE(CONN)
[output truncated for reasons of space]

That’s interesting, but fairly unreadable. Let’s examine one of the connections in more detail – asking for all of the available attributes.

dis conn(D4E4634620001002) all
    16 : dis conn(D4E4634620001002) all
AMQ8276: Display Connection details.
CONN(D4E4634620001002)
   EXTCONN(414D51434C4142325F514D2020202020)
   TYPE(CONN)
   PID(3784)                               TID(1)
   APPLTAG(WebSphere MQ\bin\amqsput.exe)   APPLTYPE(USER)
   CHANNEL( )                              CONNAME( )
   CONNOPTS(MQCNO_SHARED_BINDING)          USERID(argostr)
   UOWLOG( )                               UOWSTDA( )
   UOWSTTI( )                              UOWLOGDA( )
   UOWLOGTI( )                             URTYPE(QMGR)
   EXTURID(XA_FORMATID[00000000] XA_GTRID[] XA_BQUAL[])
   QMURID(0.0)                             UOWSTATE(NONE)

This is far more interesting – now we can see the process name and ID, the MQ connection options, information about the units of work on the queue manager…

In the next post, we’ll take a look at the use of the WHERE clause, and also see how we can combine it with the CONN object to provide more targeted output.

[1] OK, OK, so on z/OS there are more options available, but the syntax and structure is otherwise the same.

Advertisements