FreeKB - IBM MQ Purge messages in a queue using clear queue
IBM MQ - Purge messages in a queue using clear queue

Before using the clear queue command to remove all of the messages in a queue, you may want to use the display queue command to display the number of messages in the queue.

echo "display queue (QUEUE01) CURDEPTH" | runmqsc MANAGER01

 

In this example, the current depth of queue01 is 10.

QUEUE(queue01)             TYPE(QLOCAL)
CURDEPTH(10)

 

The clear queue command can be used to remove all of the messages in the queue.

echo "clear qlocal (QUEUE01)" | runmqsc MANAGER01

 

If the queue is successfully cleared, something like this should be displayed.

AMQ8022I: IBM MQ queue cleared.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

 

Reissuing the display queue command should show that the current depth of the queue is now 0.

QUEUE(queue01)             TYPE(QLOCAL)
CURDEPTH(0)


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter ea773 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |