Sunday, September 20, 2009

Selective Display in MQ

There are times where we need to quickly display all the queue depth, trying to look for queues that have more than X messages. Note that this is applicable for MQ 6 and newer.

We used this command:

dis q(*) curdepth

Result is a very long list of output with much of it unwanted.

In MQ6, the 'WHERE' parameter in introduced. The same example, say X is 1.

dis q(*) where (curdepth gt 1)

1 : dis q(*) where (curdepth gt 1)

AMQ8409: Display Queue details.

QUEUE(SYSTEM.AUTH.DATA.QUEUE) TYPE(QLOCAL)

CURDEPTH(70)

AMQ8409: Display Queue details.

QUEUE(SYSTEM.CHANNEL.SYNCQ) TYPE(QLOCAL)

CURDEPTH(4)

This time, the result returns only those of more than 1 message in the queue.

If you wish to find out which channels are having problems, can try something like this

dis chs(*) where (status ne running)

Say if we want to trace messages mysteriously disappearing from a particular queue but we don't know which application is reading from it, we can try this..

dis conn(*) where (appltype eq USER) pid connopts appltag userid channel

Here, we listed all connections by the current Queue Manager where application type is USER. This excludes all system processes and objects. Also only display the PID, MQ connection option, name of binary, user ID and perhaps the channel that the application is connecting over.

Operators allowed for boolean comparison is as follows. Note that only simple boolean allowed. No compound usage yet.

operator := [ LT | GT | EQ | NE | LE | GE | CT | EX | LK | NL | CTG | EXG ]

Have fun.

2 comments:

sam said...

Hates off to you, with this i have cleared many doubts, thanks

Phantom Cloud said...

Glad that it helped you. :)