The Remove Old Messages command removes messages that were sent prior
to a specified expiration date. This is a cleanup command that
should be run in off hours.
Because the system creates various messages queues or the user may
create certain message queues, messages may sit on queues without
anybody bothering to clean them out. The RMVOLDMSG command provides
a house cleaning function.
A typical command would be entered as:
RMVOLDMSG LIB(*ALL) DAYS(14)
This will remove all messages from all message queues that were sent
prior to 14 days ago (Certain QSYS message queues are implicitly
In order to provide the support, the RMVOLDMSG command must specify
CHGMSGQ to make all of the messages new. This allows the RCVMSG
command to receive all of the messages. Because RCVMSG is receiving
all of the messages, all messages will be consider 'old'. For
interactive users, this normally presents no difficulty as DSPMSG
will display all of the messages regardless of whether they are old
However, if you have programs that normally read specific message
queues, there could be a difference. If RMVOLDMSG is run when the
system is quiesced, your normal application logic will probably
properly receive the messages and you would normally not see any
If you expect there may be a difference, you can specify that certain
message queues be explicitly bypassed from the processing of
Certain message queues in QSYS such as QSYSOPR are implicitly
bypassed by RMVOLDMSG. See the LIB parameter.
If a message queue exists in QSYS, it may be a workstation message
queue. A workstation message queue cannot be allocated, but the
device can be allocated in many cases. If the message queue exists
in QSYS, the processing program attempts to allocate a device
description of the same name. If the device description can be
allocated, the processing program proceeds normally to receive the
There are certain reasons that a device description cannot be
** A virtual device cannot be allocated.
** When the system is IPLed, the system arbiter gains a lock on
the devices if they are requested to be varied on. If the
signon display cannot be placed on the display because the
device is powered off, the device remains in a 'Vary on
pending state'. If the device is powered on, the system
arbiter releases the lock to the appropriate subsystem which
obtains a lock. The signon prompt is displayed.
The subsystem retains the lock even if the device is signed
off or powered off. Thus the subsystem has a lock if the
signon prompt was ever displayed. As long as the device is
not signed onto, but the signon prompt has appeared, the
device can be allocated.
If the system arbiter is holding a lock, the device cannot be
For this reason, it is desirable to run the RMVOLDMSG command
just prior to powering off the system rather than just after
powering on. This will give more time for the users to power
on their devices which causes the system arbiter to give up
When the RMVOLDMSG queue command completes, either a completion
message or an escape message is sent. The completion message
contains counts for such things as the total message queues read, the
total messages that exist and the number removed.
An option exists to send a completion message if the only errors are
those caused by an allocated message queue.
Some errors are monitored for within the program such as a message
queue cannot be allocated and will cause an escape message when the
command completes. If this occurs, the escape message will contain
the previously described counts as well as a count of the errors.
Messages describing the errors will be included in the job log.
The user of the command should be authorized to operate on the
libraries and message queues named. If not, authorization exceptions
Normally, the command is intended for a user with *ALLOBJ authority
such as the security officer.
Command parameters *CMD
LIB The library name to check for message queues. You
may also specify *ALL or *USRLIBL. The following
message queues are implicitly bypassed if the QSYS
library is processed.
Msg queue Library
If you specify LIB(*ALL), you will need *ALLOBJ
authority to successfully operate on all libraries
and all message queues.
MSGQLST A list of message queues in a named library to be
processed. The default is *ALL for *ALL message
queues. *ALL must be used if the LIB parameter is
*ALL or *USRLIBL.
If a specific library is entered, up to 300 message
queues may be entered to be processed. Any other
message queues in the library will be bypassed.
If any message queue is entered, LIST(*NONE) must be
DAYS The number of days to consider for expiration of
messages. The default is 14. This means that any
messages sent prior to 14 days from the current date
will be removed.
LIST An optional list of 200 message queues that should
not be considered. These message queues will be
bypassed. *NONE is the default.
LIST The fully qualified object name must be specified.
LIST If one or more MSGQs is specified for the MSGQLST
parameter, LIST(*NONE) must be specified.
BYPALC A *YES/*NO option for whether to send a completion
message if the only errors are caused by message
queues that cannot be allocated.
*NO is the default meaning an escape message will
occur if any message queue cannot be allocated.
*YES may be specified to send a completion message
if the only errors found are due to allocation
problems. The message will contain a count of the
number of message queues that could not be
The following TAA Tools must be on your system:
ADDDAT Add date
CHKALLOBJ Check all object authority
EDTVAR Edit variable
EXTLST Extract list
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
RMVOLDMSG *CMD TAAMSGC QATTCMD
TAAMSGCC *PGM CLP TAAMSGCC QATTCL