These examples are based on a Linux system. Switch to the mqm user.
su - mqm
Before copying messages on a queue to a file, you may want to use the amqsbcg command to view the messages in the queue.
The dmpmqmsg command can be used to copy messages in a queue to a file. In this example, the messages in QUEUE01 are places in file.txt. This will not remove the messages off the queue.
dmpmqmsg -m MANAGER01 -i QUEUE01 -f /path/to/file.txt
IBM MQ Queue Load/Unload Utility
Read - Files:0 Messages:1 Bytes:181
Written – Files:1 Messages:1 Bytes:181
Then, the amqsget command can be used to GET the messages off the queue.
The dmpmqmsg command can be used to copy messages in a file to a queue, to PUT messages on the queue.
dmpmqmsg -m MANAGER01 -o QUEUE01 -f /path/to/file.txt
IBM MQ Queue Load/Unload Utility
Read - Files:1 Messages:1 Bytes:181
Written – Files:0 Messages:1 Bytes:181