CL Command Reference - CLRMSGQ

CL Command List > CLRMSGQ Reference

Description:

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.


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.