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

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.

Type
*ELEM
Required
No
Case
Uppercase

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

Type
*CHAR
Required
No
Default
*SAME
Length
5
Case
Uppercase

Allowed values: *SAME, *PRV

Call stack entry identifier Call stack entry identifier

Type
*NAME
Required
No
Default
*
Length
10
Case
Uppercase

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.

Type
*QUAL
Required
No
Default
*PGMQ
Case
Uppercase

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

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

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.

Type
*CHAR
Required
No
Length
4
Case
Uppercase

CLEAR Clear

Specifies whether one or more messages are removed from the queue.

Type
*CHAR
Required
No
Default
*BYKEY
Length
10
Case
Uppercase

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

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

Allowed values: *YES, *NO

RJTDFTRPY Reject default reply

Type
*CHAR
Required
No
Default
*NOALWRJT
Length
9
Case
Uppercase

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.

IBM command documentation

Generated from os/cl/catalog/RMVMSG.json and os/cl/help/RMVMSG.json.