Copy a local queue definition with DEFINE QLOCAL

We can copy a queue definition using the LIKE attribute on the DEFINE QLOCAL command.


We can use the DEFINE command with the LIKE attribute to creates a queue with the same attributes as the specified queue, rather than those of the system default local queue. We can also use this form of the DEFINE command to copy a queue definition, but substitute one or more changes to the attributes of the original.

Notes:
  1. When we use the LIKE attribute on a DEFINE command, you are copying the queue attributes only. You are not copying the messages on the queue.
  2. If you a define a local queue, without specifying LIKE, it is the same as:
     DEFINE LIKE(SYSTEM.DEFAULT.LOCAL.QUEUE)


Procedure

  • To creates a queue with the same attributes as the specified queue, rather than those of the system default local queue, enter the DEFINE command as shown in the following example. Enter the name of the queue to be copied exactly as it was entered when you created the queue. If the name contains lowercase characters, enclose the name in single quotation marks.

    This example creates a queue with the same attributes as the queue ORANGE.LOCAL.QUEUE, rather than those of the system default local queue:

    DEFINE QLOCAL (MAGENTA.QUEUE) +
    LIKE (ORANGE.LOCAL.QUEUE)
    
  • To copy a queue definition, but substitute one or more changes to the attributes of the original, enter the DEFINE command as shown in the following example. 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 4194304:
    DEFINE QLOCAL (THIRD.QUEUE) +
    LIKE (ORANGE.LOCAL.QUEUE) +
    MAXMSGL(1024);
    

Parent topic: Work with local queues


Related information