Delete Message Queue (DLTMSGQ)

The Delete Message Queue (DLTMSGQ) command deletes the specified message queues and any messages in those message queues. Any message in the queue that requires a reply is answered with the default reply supplied by that message. If the message queue is being used by another job, the message queue cannot be deleted.

Restrictions:

  1. You must have use (*USE), object existence (*OBJEXIST), and delete (*DLT) authority for the message queue.
  2. You must have execute (*EXECUTE) authority for the library in which the message queue is located.
  3. The system operator message queue (QSYSOPR) and work station message queues cannot be deleted.

Parameters

Keyword Description Choices Notes
MSGQ Message queue Qualified object name Required, Positional 1
Qualifier 1: Message queue Generic name, name
Qualifier 2: Library Name, *LIBL, *CURLIB, *USRLIBL, *ALL, *ALLUSR

Message queue (MSGQ)

Specifies one or more message queues to be deleted.

This is a required parameter.

Qualifier 1: Message queue

message-queue-name
Specify the name of the message queue to be deleted.
generic*-message-queue-name
Specify the generic name of the message queue that is to be deleted. A generic name is a character string that contains one or more characters followed by an asterisk (*). If a generic name is specified, then all message queues that have names with the same prefix as the generic message queue name are deleted.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is searched. If no current library exists in the library list, QGPL is used.
*USRLIBL
If a current library entry exists in the library list for the current thread, the current library and the libraries in the user portion of the library list are searched. If there is no current library entry, only the libraries in the user portion of the library list are searched.
*ALL
All libraries in the system, including QSYS, are searched.
*ALLUSR
All user libraries are searched. All libraries with names that do not begin with the letter Q are searched except for the following:

#CGULIB     #DSULIB     #SEULIB
#COBLIB     #RPGLIB
#DFULIB     #SDALIB

Although the following Qxxx libraries are provided by IBM, they typically contain user data that changes frequently. Therefore, these libraries are considered user libraries and are also searched:

QDSNX       QRCLxxxxx   QUSRDIRDB   QUSRVI
QGPL        QSRVAGT     QUSRIJS     QUSRVxRxMx
QGPL38      QSYS2       QUSRINFSKR
QMGTC       QSYS2xxxxx  QUSRNOTES
QMGTC2      QS36F       QUSROND
QMPGDATA    QUSER38     QUSRPOSGS
QMQMDATA    QUSRADSM    QUSRPOSSA
QMQMPROC    QUSRBRM     QUSRPYMSVR
QPFRDATA    QUSRDIRCF   QUSRRDARS
QRCL        QUSRDIRCL   QUSRSYS

  1. 'xxxxx' is the number of a primary auxiliary storage pool (ASP).
  2. A different library name, in the format QUSRVxRxMx, can be created by the user for each previous release supported by IBM to contain any user commands to be compiled in a CL program for the previous release. For the QUSRVxRxMx user library, VxRxMx is the version, release, and modification level of a previous release that IBM continues to support.
name
Specify the library to be searched.

Examples

DLTMSGQ   MSGQ(JONES)

This command deletes the message queue named JONES. Messages stored in the JONES queue are also removed. The library list is used to find the message queue.

Error messages

*ESCAPE Messages

CPF2105
Object &1 in &2 type *&3 not found.
CPF2110
Library &1 not found.
CPF2117
&4 objects type *&3 deleted. &5 objects not deleted.
CPF2182
Not authorized to library &1.
CPF2403
Message queue &1 in &2 not found.
CPF2408
Not authorized to message queue &1.
CPF2451
Message queue &1 is allocated to another job.
CPF2477
Message queue &1 currently in use.
CPF2505
Deleting work station message queue not allowed.
CPF9830
Cannot assign library &1.