Clear Message Queue (CLRMSGQ)
Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Clear Message Queue (CLRMSGQ) command clears (removes) all messages from a specified message queue. Once cleared, the data can no longer be displayed or printed. If the specified message queue is not allocated to a job, it is implicitly allocated by this command for the duration of the command. If the specified message queue is *WRKSTN or a work station message queue, it is not allocated and the message queue is cleared even if the work station device description is allocated to another job.
Restriction: You must have change (*CHANGE) authority to the message queue and use (*USE) authority to the library where the message queue is stored.
Top |
Parameters
Keyword | Description | Choices | Notes |
---|---|---|---|
MSGQ | Message queue | Qualified object name | Required, Positional 1 |
Qualifier 1: Message queue | Name, *WRKSTN | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
CLEAR | Clear | *ALL, *KEEPUNANS | Optional |
Top |
Message queue (MSGQ)
Specifies the message queue to be cleared. If a specific message queue name is specified with a library qualifier of *LIBL, only the first message queue found with that name is cleared.
This is a required parameter.
Qualifier 1: Message queue
- *WRKSTN
- The work station message queue is cleared. This is not allowed in batch mode.
- message-queue-name
- Specify the name of the message queue to be cleared.
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 thread is searched to locate the message queue to be cleared. If no current library exists in the library list, the QGPL library is used.
- library-name
- Specify a library name where the message queue is located. Only the library named in this parameter is searched.
Top |
Clear (CLEAR)
Specifies which messages to clear from the message queue.
- *ALL
- Clears all messages on the message queue. If there are any unanswered messages on the queue, the default reply for the message is sent before the message is removed.
- *KEEPUNANS
- All messages except unanswered inquiry messages and sender copy messages are removed from the specified message queue.
Top |
Examples
Example 1: Clearing All Messages
CLRMSGQ MSGQ(*CURLIB/MQFIN) CLEAR(*ALL)
This command clears all messages from a message queue named MQFIN, which is located in the current library for the job.
Example 2: Keeping Unanswered Messages
CLRMSGQ MSGQ(*CURLIB/MQFIN) CLEAR(*KEEPUNANS)
This command clears all messages except unanswered inquiry messages from a message queue called MQFIN, which is located in the current library for the job.
Top |
Top |