CLEAR QLOCAL (clear messages from local queue)

Use the MQSC command CLEAR QLOCAL to clear the messages from a local queue.

Using MQSC commands

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

[z/OS]You can issue this command from sources 2CR. For an explanation of the source symbols, see Sources from which you can issue MQSC commands on z/OS®.

Synonym: CLEAR QL

CLEAR QLOCAL

Read syntax diagramSkip visual syntax diagram CLEAR QLOCAL ( q-name ) CMDSCOPE(' ')CMDSCOPE(qmgr-name)1CMDSCOPE(*)2QSGDISP(PRIVATE)QSGDISP(SHARED)12
Notes:
  • 1 Valid only on z/OS when the queue manager is a member of a queue sharing group.
  • 2 Valid only on z/OS.

Parameter descriptions for CLEAR QLOCAL

You must specify which local queue you want to clear.

The command fails if any one of the following occurs. The queue:
  • Has uncommitted messages that have been put on the queue under syncpoint.
  • Is currently open by an application (with any open options).
  • Is currently open by a channel.

    For performance reasons, receiver channels cache opened queue handles for queues to which they deliver messages on behalf of remote queue managers. If a channel has cached a handle to this queue, it cannot be cleared.

    To resolve this, stop the channel. Alternatively, empty the queue by getting all the messages from it, instead of using the CLEAR QLOCAL command.

If an application has this queue open, or has a queue open 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.
(q-name)
The name of the local queue to be cleared. The name must be defined to the local queue manager.
[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 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.
[z/OS]QSGDISP
Specifies whether the queue definition is shared. This parameter applies to z/OS only.
PRIVATE
Clear only the private queue named q-name. The queue is private if it was defined using a command that had the parameters QSGDISP(COPY) or QSGDISP(QMGR). This is the default value.
SHARED
Clear only the shared queue named q-name. The queue is shared if it was defined using a command that had the parameters QSGDISP(SHARED).