Copying a local queue definition

We can copy a queue definition using the CPYMQMQ command. For example:

CPYMQMQ FROMQ('orange.local.queue') TOQ('magenta.queue') MQMNAME(MYQUEUEMANAGER)

This command creates a queue with the same attributes as our original queue orange.local.queue, rather than those of the system default local queue.

We can also use the CPYMQMQ command to copy a queue definition, but substituting one or more changes to the attributes of the original. For example:

CPYMQMQ FROMQ('orange.local.queue') TOQ('third.queue') MQMNAME(MYQUEUEMANAGER)
MAXMSGLEN(1024)

This command copies the attributes of the queue orange.local.queue to the queue third.queue, but specifies that the maximum message length on the new queue is to be 1024 bytes, rather than 2000.

Note:
When you use the CPYMQMQ command, you copy the queue attributes only, not the messages on the queue.