Command reference / msg
RMVMSG
Remove Message
Used by a program to remove a specified message, or a group of messages, from the specified message queue. If an unanswered inquiry message is removed, the default reply is sent before it is removed. If the queue is not allocated to the job issuing the command and no other job has it allocated, this command implicitly allocates it for the duration of the command.
Allowed environments: *BPGM, *IPGM, *BREXX, *IREXX.
Use within a CL program.
Positional parameters: 0.
Restrictions
- The command is valid only in a compiled CL program.
- To remove messages from the queue, you must have *CHANGE authority for the queue and *USE authority for the library containing it.
Parameters
PGMQ
Call stack entry message queue
Specifies the call message queue from which messages are removed. Messages can be removed from the external queue (*EXT) or from a message queue associated with a call stack entry. If CLEAR(*BYKEY) is specified, this parameter is ignored.
Suggested / special values:
*ALLINACT, *EXT
*ALLINACT- All messages for inactive call stack entries are removed from the user's job message queue; requires CLEAR(*ALL).
*EXT- The message is removed from the external message queue of the job.
*SAME- The message is removed from the message queue of the program or procedure named in element 2 (relationship element).
*PRV- The message is removed from the message queue of the program or procedure that called the one named in element 2.
*- Element 1 (call stack entry): the OPM program or ILE procedure running this command.
*NONE- Element 2 (module) or element 3 (program): no ILE module or program qualifier is provided.
Elements in order
Relationship
Relationship
Allowed values:
*SAME, *PRV
Call stack entry identifier
Call stack entry identifier
Suggested / special values:
*
MSGQ
Message queue
Specifies the message queue from which one or more messages are removed. If this parameter is specified, the PGMQ parameter cannot be.
Suggested / special values:
*PGMQ
*PGMQ- The call message queue specified for PGMQ is the only queue used; cannot be used with CLEAR(*KEEPUNANS).
*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 used to locate the queue; QGPL is used if no current library is set.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Message queue
Message queue
Library
Library
Suggested / special values:
*LIBL, *CURLIB
MSGKEY
Message key
Specifies the name of the CL variable that contains the message reference key of the message to be removed. This parameter can be specified only if CLEAR(*BYKEY) is specified.
CLEAR
Clear
Specifies whether one or more messages are removed from the queue.
Allowed values:
*BYKEY, *ALL, *KEEPUNANS, *OLD, *NEW
*BYKEY- The message identified by the CL variable named in MSGKEY is removed.
*ALL- All messages are removed from the specified queue.
*KEEPUNANS- All messages except unanswered inquiry messages are removed; a message queue name must be specified.
*OLD- All old messages in the specified queue are removed.
*NEW- All new messages in the specified queue are removed.
RMVEXCP
Remove unhandled exceptions
Allowed values:
*YES, *NO
RJTDFTRPY
Reject default reply
Allowed values:
*NOALWRJT, *ALWRJT
Examples
RMVMSG MSGQ(SMITH) MSGKEY(&KEY)
Removes the message whose reference key is in the CL variable &KEY from message queue SMITH.
RMVMSG MSGQ(SMITH) CLEAR(*KEEPUNANS)
Removes all messages from message queue SMITH except unanswered inquiry messages.
Generated from os/cl/catalog/RMVMSG.json and os/cl/help/RMVMSG.json.