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)