Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Create a Queue Manager

$ crtmqm REPLACE_QMGR_NAME

Delete a Queue Manager

$ dltmqm REPLACE_QMGR_NAME

Start Queue Manager

$ strmqm REPLACE_QMGR_NAME

Stopping Queue Manager

Wait for queue manager to shutdown

$ endmqm -w REPLACE_QMGR_NAME

End Immediately

$ endmqm -i REPLACE_QMGR_NAME

Start Queue Manager (Init Script)

By default Websphere MQ does not ship with an init script, you can add this functionality via
a support pac (MSL1) provided by IBM.

$ service ibm.com-WebSphere_MQ start

Stopping Queue Manager (Init Script)

$ service ibm.com-WebSphere_MQ stop

Start MQ Listener

$ echo "start LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)" | runmqsc


REPLACE_QMGR_NAME

Stop MQ Listener

$ echo "stop LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)" | runmqsc


REPLACE_QMGR_NAME

Display Queue Managers & Status

$ dspmq

Set MQ Privileges

In order for a Unix user to start utilizing MQ they must have the appropriate privileges. You
can find the available privileges in IBM’s Documentation.
Set MQ Privileges By User

$ setmqaut -m REPLACE_QMGR_NAME -t qmgr -p REPLACE_USER


REPLACE_PLUS_OR_MINUS_PRIVILEGE

Set MQ Privileges By Groups

$ setmqaut -m REPLACE_QMGR_NAME -t qmgr -g REPLACE_GROUP


REPLACE_PLUS_OR_MINUS_PRIVILEGE

Display MQ Privileges

Display MQ Privileges By Users

$ dspmqaut -m REPLACE_QMGR_NAME -t qmgr -p REPLACE_USER

Display MQ Privileges By Groups

$ dspmqaut -m REPLACE_QMGR_NAME -t qmgr -g REPLACE_GROUP

Lookup MQ Error Numbers

$ mqrc REPLACE_ERROR_NUM

MQ Sample Scripts

Within the MQ release by IBM there is a package that contains sample scripts for MQ. There
are about 3 of these sample scripts that I have found pretty useful.

Pop (GET) Messages off a queue

$ amqsget REPLACE_Q_NAME REPLACE_QMGR_NAME

This command will remove messages from the queue, only use this if you no longer want the
messages in the queue.

Browse Messages in a queue

$ amqsbcg REPLACE_Q_NAME REPLACE_QMGR_NAME

Open a Queue for writing

$ amqsput REPLACE_Q_NAME REPLACE_QMGR_NAME

When you find yourself with a system that is connected to a repository but doesn’t see new
messages you can try opening the queue for writing with amqsput to “refresh” the
connectivity. You do not have to write anything to the queue. Simply open the queue and
press ctrl+d without typing any additional characters.

Open Websphere MQ CLI

$ runmqsc REPLACE_QMGR_NAME
Websphere MQ CLI Commands
The following commands are to be run directly from the MQ command line interface.

Start MQ Listener

start LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)

Stop MQ Listener

stop LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)

Disable Channel Authentication

alter qmgr chlauth(disabled)

Channel Authentication is new as of MQ 7.0. If your systems don’t use it you can simply turn
it off.

Display Queues

All Queues

display queue(*)

Specific Queues

display queue(REPLACE_Q_NAME)

Short hand

dis q(REPLACE_Q_NAME)

Display Local Queues only

All Queues

display qlocal(*)

Specific Queue

display qlocal(REPLACE_Q_NAME)

Short hand

dis ql(REPLACE_Q_NAME)

Display Alias Queues only

All Queues

display qalias(*)
Specific Queue

display qalias(REPLACE_Q_NAME)

Short hand

dis qa(REPLACE_Q_NAME)

Display Cluster Queues only

All Queues

display qcluster(*)

Specific Queue

display qcluster(REPLACE_Q_NAME)

Short hand

dis qc(REPLACE_Q_NAME)

Display Channels

All Channels

display channel(*)

Specific Channel

display channel(REPLACE_CHANNEL_NAME)

Short hand

dis channel(REPLACE_CHANNEL_NAME)

Display Channel Status

All Channels

display chstatus(*)

Specific Channel

display chstatus(REPLACE_CHANNEL_NAME)

Short hand

dis chstatus(REPLACE_CHANNEL_NAME)

Display Local Queue Manager Information

display qmgr
Display Cluster Queue Manager Information

display clusqmgr(REPLACE_CLUSQMGR_NAME)

Show number of INPUT and OUTPUT threads open

display qstatus(REPLACE_Q_NAME) IPPROCS OPPROCS

Find Process ID of Processes Accessing Queue

display qstatus(REPLACE_Q_NAME) TYPE(HANDLE) ALL

Refresh Cluster Queue Manager

refresh cluster(REPLACE_CLUSQMGR_NAME)

Start Channel

start channel(REPLACE_CHANNEL_NAME)

Command to lists the Queue Manager name and status

In order to list all Queue manager with there current status use command dspmq

Command to lists the MQ Series version

In order to view MQ Series version Type dspmqver

Command to create queue manager objects.

Syntax : runmqsc <QueueManager Name> Example : runmqsc Excercise1QM

Command to create local queue (MQSC command)

Syntax : define qlocal or ql <(QueueName)> Example : define qlocal (Excercise1QL1)

Command to put test messages onto a queue

Syntax : amqsput <QueueName> <QueueManager Name> Example :


amqsput Excercise1QL1 Excercise1QM

Command to browse message onto a queue

Syntax : amqsbcg or amqsgbr <QueueName> <QueueManager Name> Example :


amqsbcg Excercise1QL1 Excercise1QM

Command to delete/get message from a queue

Syntax : amqsput <QueueName> <QueueManager Name> Example :


amqsput Excercise1QL1 Excercise1QM
MQSC Command to display & alter properties or list queue manager objects

Display all queues of the queue manager

DISPLAY or DIS Q(*)

Display all local queues of the queue manager

DIS QL(*)

Command to create Remote Queue

DEF QR (Queue Name)

Example : DEF QR (Excercise1QR1) Ó Command to display Remote queue DIS QR(


Excercise1QR1) DIS QR(*) : Will display all Remote queues of the queue manager

Command to create Model Queue

DEF QM (Queue Name)

Example : DEF QM (Excercise1QM1)

Command to display Model Queue

DIS QM( Excercise1QM1) DIS QM(*) : Will display properties of the all Model queue

Display properties of the queue manager

DIS QMGR

DIS is the command to “display” the properties of the QueueManager like Trigger Interval,
Max Handles, Max message length,TCP port etc.

Delete queue

DELETE QL(Queue Name) --> Throw an error if queue is not empty, so first clear the queue,
then delete.

CLEAR QL(Queue Name)

Display properties of the system queue

DIS QL(SYSTEM*)

Display CURDEPTH & MAXDEPTH property of the queue

DIS QL(Queue Name) CURDEPTH MAXDEPTH


CURDEPTH stands for Current depth of the particular queue and MAXDEPTH stands for
Maximum depth of the particular queue

Working with Persistent queue

ALT QL(Queue Name) DEFPSIST(YES)

The above command is to Alter the localqueue along with Persistence

DIS QL(Queue Name) DEFPSIST The above command is to Display the local queue along
with Persistence

Note : Put some messages using amqsput command and re-start queue manager Messages
will be present

Working with Dead Letter queue

- To create normal local queue.

- DEF QL(Excercise1DLQ1) DEFPSIST(YES)


MAXDEPTH(1000000) MAXMSGL(41943040)

- Assign DLQ to queue manager ALT QMGR DEADQ(Excercise1DLQ1)

-To display DLQ DIS QMGR DEADQ

You might also like