DELETE queues

Use the MQSC DELETE command to delete a queue definition for a local, model, or remote queue, or a queue alias.

Using MQSC commands

For information on how you use MQSC commands, see Performing local administration tasks using MQSC commands.

Usage notes for DELETE queues

Parameter descriptions for DELETE queues

(q-name)
The name of the queue must be defined to the local queue manager for all the queue types.

For an alias queue this is the local name of the alias queue to be deleted.

For a model queue this is the local name of the model queue to be deleted.

For a remote queue this is the local name of the remote queue to be deleted.

For a local queue this is the name of the local queue to be deleted. You must specify which queue you want to delete.

Note: A queue cannot be deleted if it contains uncommitted messages.

If an application has this queue open, or has open a queue that eventually resolves to this queue, the command fails. The command also fails if this queue is a transmission queue, and any queue that is, or resolves to, a remote queue that references this transmission queue, is open.

If this queue has a SCOPE attribute of CELL, the entry for the queue is also deleted from the cell directory.

AUTHREC
This parameter does not apply to z/OS.

Specifies whether the associated authority record is also deleted:

YES
The authority record associated with the object is deleted. This is the default.
NO
The authority record associated with the object is not deleted.
[z/OS]CMDSCOPE
This parameter applies to z/OS only and specifies how the command runs when the queue manager is a member of a queue sharing group.
CMDSCOPE must be blank, or the local queue manager, if QSGDISP is set to GROUP or SHARED.
' '
The command runs on the queue manager on which it was entered. This is the default value.
qmgr-name
The command runs on the queue manager you specify, providing the queue manager is active within the queue sharing group.

You can specify a queue manager name, other than the queue manager on which the command was entered, only if you are using a queue sharing group environment and if the command server is enabled.

*
The command runs on the local queue manager and is also passed to every active queue manager in the queue sharing group. The effect of this is the same as entering the command on every queue manager in the queue sharing group.
PURGE and NOPURGE
Specifies whether any existing committed messages on the queue named by the DELETE command are to be purged for the delete command to work. The default is NOPURGE.
PURGE
The deletion is to go ahead even if there are committed messages on the named queue, and these messages are also to be purged.
NOPURGE
The deletion is not to go ahead if there are any committed messages on the named queue.
[z/OS]QSGDISP
Specifies the disposition of the object to which you are applying the command (that is, where it is defined and how it behaves). If the object definition is shared, you do not need to delete it on every queue manager that is part of a queue sharing group. (Queue sharing groups are available only on IBM® MQ for z/OS.)
COPY
The object definition resides on the page set of the queue manager that executes the command. The object was defined using a command that had the parameters QSGDISP(COPY). Any object residing in the shared repository, or any object defined using a command that had the parameters QSGDISP(QMGR), is not affected by this command.
GROUP
The object definition resides in the shared repository. The object was defined using a command that had the parameters QSGDISP(GROUP). Any object residing on the page set of the queue manager that executes the command, or any object defined using a command that had the parameters QSGDISP(SHARED), is not affected by this command.
If the deletion is successful, the following command is generated and sent to all active queue managers in the queue sharing group to make, or delete, local copies on page set zero:

DELETE queue(q-name) QSGDISP(COPY)
or, for a local queue only:

DELETE QLOCAL(q-name) NOPURGE QSGDISP(COPY)
The deletion of the group object takes effect even if the generated command with QSGDISP(COPY) fails.
Note: You always get the NOPURGE option even if you specify PURGE. To delete messages on local copies of the queues, you must explicitly issue the command:

DELETE QLOCAL(q-name) QSGDISP(COPY) PURGE

for each copy.

QMGR
The object definition resides on the page set of the queue manager that executes the command. The object was defined using a command that had the parameters QSGDISP(QMGR). Any object residing in the shared repository, or any local copy of such an object, is not affected by this command.

This is the default value.

SHARED
This option applies only to local queues.

The object definition resides in the shared repository. The object was defined using a command that had the parameters QSGDISP(SHARED). Any object residing on the page set of the queue manager that executes the command, or any object defined using a command that had the parameters QSGDISP(GROUP), is not affected by this command.

[MQ 9.2.1 Dec 2020][AIX, Linux, Windows]IGNSTATE
This parameter allows you to specify whether you want the command to return an error code if the object is already in the state the command moves it to.
A value of YES means the return code and message are the same as if the MQSC object has not been deleted.

A value of NO means that the return code is zero, even if the object has been deleted. This is the default value.