Tag Archives: WebSphere MQ

My Websphere MQ command line cheat sheet

Here is my cheat sheet for IBM Websphere 5.3 command line/runmqsc commands:

Start MQSC

runmqsc <qmanager>

MQSC:show queue information

display q(<qname>)

MQSC:remove all messages from queue

clear ql(<qname>)

MQSC:enable trigger on queue

alter ql(<qname>) trigger

MQSC:disable trigger on queue

alter ql(<qname>) notrigger

MQSC:show process information

display process(<process>)

Using runmqsc in a script

echo "dis q(*)" | runmqsc <qmanager>

This vill display all queues (‘dis q(*)’) on the qmanager <qmanager>

Using the q (ma01) program to distribute messages from one queue to two queues

q -m QMGR -I TEST.DISTLIST.IN -o TEST.DISTLIST.OUT1 -o TEST.DISTLIST.OUT2

Sending the same message to two or more queues using the Q program

During development of integration solutions I often find it useful to send the same message too two or more different queues. Doing this with the Q-program (ma01) is really easy since it can do this natively

q -m MYQMGR -I MYINQ -o MYOUTQ1 -o MYOUTQ2

This will move all messages from MYINQ and put them on both MYOUTQ1 and MYOUTQ2 on q manager MYQMGR. The trick is to use multiple -o options. The Q program will put the messages on all the queues listed.

To copy instead of move change the -I to -i like this:

q -m MYQMGR -i MYINQ -o MYOUTQ1 -o MYOUTQ2

This will leave the messages on MYINQ and only copy them to MYOUTQ1 and MYOUTQ2

Setting up remote administration with MQ Explorer on MQSeries 5.3

This is what needs to be done on the SERVER that is going to be administrated:

  • Create a new channel with CHLTYPE(SVRCONN), TRPTYPE(TCP) and MCAUSER(‘mqm’) (eg. define channel(SERVER.CONNECTION) CHLTYPE(SVRCONN) TRPTYPE(TCP) MCAUSER(‘mqm’) in runmqsc)
  • Create a new model called SYSTEM.MQEXPLORER.REPLY.MODEL (eg. define qmodel(SYSTEM.MQEXPLORER.REPLY.MODEL) in runmqsc)
  • Now start the command server: strmqcsv <QManager>

Now we are going to setup the CLIENT MQ Explorer

  1. Right click “Queue Managers” and choose “Show/Hide Queue Managers”
    Show/Hide Queue Managers
  2. Click “Add”
    Add button
  3. Queue Manager name is the name of the QManager of the server you want to administrate
    Queue Manager NamePress “Next”
  4. Now enter the Host name/IP address, Port and the Server connection channel you defined on the server
    Connection detailsNow press “Finished”
  5. If everything is correct MQ Explorer will now connect to the QManager

If the connection fails be sure to check firewall settings so that you are allowed to connect to the server on the desired port (port 1414 in this example)