Monday, August 27, 2018

WebSphere MQ Basic commands

IBM MQ Commands

Commands are case sensitive and lower case.

Some of the most popular sample programs are:

amqsput PUT

amqsbcg BROWSE

amqsget GET

These are some of the most common:

crtmqm – creates QMGR

strmqm – starts QMGR

endmqm – ends QMGR

dltmqm – deletes QMGR

runmqsc – starts MQ script

Create a queue manager
command:
 crtmqm QM1

Start the queue manager
 strmqm QM1

Starting MQSC for queue manager QM1.
 runmqsc QM1

Create a local queue called LQ1
 define qlocal(LQ1)

Stop the scripting tool (command line )
 end

Display Queue Manager details
DIS QMGR CONNAUTH


Displaying Queue Manager Status
 dspmq

Putting a message to the Queue LQ1
 amqsput LQ1 QM1

To end amqsput, press Enter.

Getting messages from the Queue LQ1
amqsget LQ1 QM1

Create a MQ Listener
Add Listener definition using the following commands
./runmqsc QM1
DEFINE LISTENER(QM1.listener) TRPTYPE (TCP) PORT(1414)
START LISTENER(QM1.listener)
end

Create a MQ channel

runmqsc QM1
DEFINE CHANNEL(channel_test) +
CHLTYPE(SVRCONN) +
TRPTYPE(TCP) +
DESCR(‘WebSphere MQ Default Channel’) +
REPLACE
End

****************************************
* Command: "C:\Program Files\IBM\MQ\bin\crtmqm"  -sa  QM1
****************************************

IBM MQ queue manager created.
Directory 'C:\ProgramData\IBM\MQ\qmgrs\QM1' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'QM1'.
Default objects statistics : 86 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
exitvalue = 0
****************************************
* Command: "C:\Program Files\IBM\MQ\bin\strmqm" QM1
****************************************

IBM MQ queue manager 'QM1' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'QM1' during the log replay phase.
Log replay for queue manager 'QM1' complete.
Transaction manager state recovered for queue manager 'QM1'.
IBM MQ queue manager 'QM1' started using V9.0.0.2.
exitvalue = 0
****************************************
* Command: "C:\Program Files\IBM\MQ\bin\runmqsc" QM1
* Input: DEFINE LISTENER('LISTENER.TCP') TRPTYPE(TCP) PORT(1414) CONTROL(QMGR)
****************************************
5724-H72 (C) Copyright IBM Corp. 1994, 2016.
Starting MQSC for queue manager QM1.
     1 : DEFINE LISTENER('LISTENER.TCP') TRPTYPE(TCP) PORT(1414) CONTROL(QMGR)
AMQ8626: IBM MQ listener created.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
exitvalue = 0
****************************************
* Command: "C:\Program Files\IBM\MQ\bin\runmqsc" QM1
* Input: START LISTENER('LISTENER.TCP')
****************************************
5724-H72 (C) Copyright IBM Corp. 1994, 2016.
Starting MQSC for queue manager QM1.
     1 : START LISTENER('LISTENER.TCP')
AMQ8021: Request to start IBM MQ listener accepted.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
exitvalue = 0