TAA Tools
CLRMSGQ2        CLEAR MESSAGE QUEUE 2                  TAAMSKK

The Clear  Message Queue 2  command allows you  to clear messages  from
one or more  message queues based on the number  of hours a message has
been  on the queue.  CLRMSGQ2 may be  used for any system message queue
such as  QSYSOPR or QSYSMSG  or any  user message queue.   The  command
defaults  to ACTION(*CHECK)  to  provide an  indication  of what  would
happen if ACTION(*REMOVE) had been specified.

You  must have  *ALLOBJ special  authority to use  CLRMSGQ2.   The QHST
message queue in QSYS is implicitly bypassed.

A typical command would be


A listing  would be  displayed with  one line  for  each message  queue
found in QSYS and  the number of messages that  would have been removed
and  the number remaining if  ACTION(*REMOVE) had been  specified.  The
QHST message queue is implicitly bypassed.

If after reviewing the  results, you want to  remove the old  messages,


CLRMSGQ2 escape messages you can monitor for

      TAA9891    No message queues found.
      TAA9892    Unable to remove messages as requested.

Escape messages from based on functions will be re-sent.

CLRMSGQ2 Command parameters                           *CMD

   MSGQ          The  qualified  name  of  the   message  queue  to  be
                 cleared.   A single message queue, a  generic name, or
                 the special value *ALL may be specified.

                 The  library  value  defaults to  *LIBL.    A specific
                 library, *CURLIB,  *USRLIBL, *ALL,  or *ALLUSR may  be

   NBRHRS        The number  of hours to retain messages  from the time
                 they  were sent.   24 is the default  meaning that all
                 messages that  arrived on  the queue  in  the last  24
                 hours would be  retained.  It must be  a value between
                 0 and 99999.

   ACTION        The action to be performed.

                 *CHECK  is the  default meaning  no messages  would be
                 removed.    The  listing  of  messages  describe  what
                 would  have  occurred  if   ACTION(*REMOVE)  had  been

                 *REMOVE may be specified to remove the messages.

   OUTPUT        How  to  output the  results.   *  is  the default  to
                 display  the spooled  file if  the command  is entered
                 interactively.  The spooled  file is deleted after  it
                 is displayed if  it is ended with F3/F12  or the Enter
                 key.   To  retain the  spooled file,  you may  use the
                 the System Request 'Cancel'  function and the  spooled
                 file will exist in a HLD status.

                 If  the  command is  entered  in  batch or  *PRINT  is
                 specified,  the spooled  file is output  and retained.


You must have *ALLOBJ special authority to use CLRMSGQ2.

The QHST message queue in QSYS is implicitly bypassed.


The following TAA Tools must be on your system:

     ADDTIM          Add time
     CHKALLOBJ       Check *ALLOBJ special authority
     CVTMSGQ         Convert message queue 2
     CVTOBJD2        Convert object description 2
     EDTVAR          Edit variable
     RTVMSGQA        Retrieve message queue attributes
     RTVOBJLCK       Retrieve object lock
     SNDCOMPMSG      Send completion message
     SNDDIAGMSG      Send diagnostic message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message


None, the tool is ready to use.

Objects used by the tool

   Object        Type    Attribute      Src member    Src file
   ------        ----    ---------      ----------    ----------

   CLRMSGQ2      *CMD                   TAAMSKK       QATTCMD
   TAAMSKKC      *PGM       CLP         TAAMSKKC      QATTCL
   TAAMSKKR      *PGM       RPG         TAAMSKKR      QATTRPG

Added to TAA Productivity tools April 15, 2013

Home Page Up to Top