TAA Tools
RMVQSYSMSG      REMOVE QSYSMSG MESSAGES                TAASYTY

The Remove QSYSMSG Messages  tool allows both removal and  archiving of
messages  from  the QSYSMSG  system  message queue.    Removal is  done
based  on the  number of  days to  retain the  messages.   Archiving is
optional and provides for the  QSYSMSGP file in QGPL.  If  archiving is
used,  all  new  messages  (not  previously  archived)  are  copied  to
QSYSMSGP.

To  remove  messages  from  QSYSMSG and  not  archive  them,  a typical
command would be:

              RMVQSYSMSG  RTNDAYS(3) ARCHIVE(*NO)

Any messages that  were older  than 3  days would be  removed from  the
QSYSMSG message queue.

To archive the messages, you must first create the required file:

              CRTQSYSMSF

The QSYSMSGP physical file would be created in QGPL.

A typical use of  the RMVQSYSMSG tool would be  to both remove messages
from  the  QSYSMSG  message  queue  and  archive  any new  messages  to
QSYSMSGP:

              RMVQSYSMSG  RTNDAYS(3) ARCHIVE(*YES)

Any messages that  were older  than 3 days  would be  removed from  the
QSYSMSG message queue.   The last record  in QSYSMSGP is read  (if any)
and  the  date  and time  that  the  message  was  sent to  QSYSMSG  is
determined.   Any  messages in QSYSMSG  that did not  exist in QSYSMSGP
and have a  date/time more later  than the last  record would be  added
to QSYSMSGP.   A listing is produced of all messages  and a flag occurs
for those messages that were removed.

You  can also archive  new messages, but  not remove  any messages from
QSYSMSG with:

              RMVQSYSMSG   RTNDAYS(*ALL) ARCHIVE(*YES)

You can use the previous command  several times per day to help  ensure
that  no  messages  were  lost   by  accidentally  removing  them  from
QSYSMSG.

To display the messages in QSYSMSGP, use the display command:

             DSPQSYSMSG

Messages would  be displayed in date/time order.   An alternative is to
display them in message ID order.

The MTNQSYSMSG command  exists to  cleanup old  messages from  QSYSMSGP
when they are no longer needed.

              MTNQSYSMSG   RTNDAYS(30)

All messages  that were 30  days old  or less would  be retained.   The
older messages would be deleted.

QSYSMSG Message Queue
----------------------

The  QSYSMSG  message  queue cannot  be  allocated  by  another job  if
RTNDAYS  is not  *ALL.   It is possible  to convert  the messages while
another job  holds a  lock, but removal  of messages  is not  possible.
An internal  check by RMVQSYSMSG attempts  to allocate the  queue to an
*EXCL lock  state to ensure that messages can  be removed.  The lock is
removed if the allocate is successful.

QSYSMSGP File
-------------

The QSYSMSGP file uses  the same format as that  used by CVTMSGQ.   The
format name is MSGLSTR with key fields added for date and time.

CVTMSGQ is  used to copy  the messages from QSYSMSG  to a work  file in
QTEMP during  the use of RMVQSYSMSG.  If a  new message exists that has
not been  written to  QSYSMSGP, the  same  data is  used for  the  same
field names.   Only the  fields for the  convert date and  time (MQCVTD
and  MQCVTT)  are  changed  to  reflect  the current  values  for  when
RMVQSYSMSG was run.

Some  fields  in the  QSYSMSGP file  (such as  Msg Severity,  and Alert
option) are not  listed by DSPQSYSMSG.   To list the additional  fields
a query may be used such the TAA Tool PRTDB.

Commands provided
-----------------

         CRTQSYSMSF     Creates the QSYSMSGP file for archiving
         DLTQSYSMSF     Deletes the QSYSMSGP file
         RMVQSYSMSG     Removes messages and archives
         DSPQSYSMSG     Displays messages from the archive
         MTNQSYSMSG     Maintains the QSYSMSGP archive

Maintaining QSYSMSGP
--------------------

The QSYSMSGP  file should be periodically  purged of old records.   The
MTNQSYSMSG  command allows  a retention  date (default  of 30  days) to
cleanup the file.

When MTNQSYSMSG runs, it places an  *EXCL lock on the file in QGPL  and
then  copies  the  QSYSMSGP  file  in QGPL  to  the  QSYSMSGP  file  in
TAAWORK.   The QSYSMSGP  file in QGPL  is then cleared  and the records
are  copied  back  if  they  meet  the  retention  criteria.    At  the
completion of  MTNQSYSMSG, the version  in TAAWORK  is deleted and  the
lock on the version in QGPL is removed.

If the  command or system  fails during the running  of MTNQSYSMSG, the
original  information is still retained in  the TAAWORK library and may
be used to refresh the QSYSMSGP file with a simple copy.

If the QSYSMSGP  file exists  in TAAWORK when  MTNQSYSMSG is used,  the
command  ends  with  an escape  message  as  the  previous use  of  the
command  did not end  normally.  If  a complex recovery  is needed, the
use of  CPYF with  selection on  the the  MQMSGD field  (start date  in
CYMD format) in QSYSMSGP could be used.

RMVQSYSMSG escape messages you can monitor for
----------------------------------------------

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

MTNQSYSMSG escape messages you can monitor for
----------------------------------------------

      TAA9891    No records exist in QSYSMSGP

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

CRTQSYSMSF Command parameters                         *CMD
-----------------------------

   SRCLIB        The  source library  of the  DDS source.   *TAAARC  is
                 the  default   to  access  the  source  from  the  TAA
                 Archive.  A specific library  may also be used if  you
                 have  first copied  the  source  from the  Archive  to
                 your library.   The source  file name QATTDDS  must be
                 used.

   AUT           The  authority  of the  public  to the  QSYSMSGP file.
                 *USE is  the  default.   *CHANGE  or *EXCLUDE  may  be
                 specified

DLTQSYSMSF Command parameters                         *CMD
-----------------------------

No parameters exist.


RMVQSYSMSG Command parameters                         *CMD
-----------------------------

   RTNDAYS       The number  of days to retain messages  in the QSYSMSG
                 message  queue.    The default  is  3.    Any messages
                 older than 3 days would be removed.

                 The value entered  must be  between 0 and  999 or  the
                 special value *ALL.   *ALL should be used  when you do
                 not want  to remove any messages,  but want to archive
                 any new  messages.   If no  new messages  exist to  be
                 archived, the command completes normally.

   ARCHIVE       A *YES/*NO parameter  for whether messages  in QSYSMSG
                 should be archived to the QSYSMSGP file in QGPL.

                 *YES is the default.

                 *NO  may  be specified  to  use  RMVQSYSMSG to  remove
                 messages only.

   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  the  command  is entered  in  batch  or  *PRINT is
                 specified, the spooled  file is  output and  retained.


DSPQSYSMSG Command parameters                         *CMD
-----------------------------

   SEQ           The sequence of the listing that is output.

                 *DATE  is  the  default  to  output  the  messages  in
                 date/time sequence.

                 *MSGID  may  be  specified  to  output  in message  ID
                 sequence.

   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  the  command  is  entered in  batch  or  *PRINT is
                 specified, the  spooled file  is output and  retained.


MTNQSYSMSG Command parameters                         *CMD
-----------------------------

   RTNDAYS       The number of days to retain messages for.

                 30  is  the  default  meaning any  messages  that  are
                 older than 30 days would be deleted.

                 Messages  are deleted by copying  the QSYSMSGP file to
                 the  TAAWORK  library  and  then  copying  back  those
                 records which  have a  date greater  than or equal  to
                 the  number of retention  days specified.   If a error
                 occurs, see  the  previous  documentation  on  how  to
                 recover.

Restrictions
------------

None.

Prerequisites
-------------

The following TAA Tools must be on your system:

     ADDDAT          Add date
     CVTDAT          Convert date
     CVTMSGQ         Convert message queue
     EDTVAR          Edit variable
     RSNLSTMSG       Resend last message
     RTVSYSVAL3      Retrieve system value 3
     SNDCOMPMSG      Send completion message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message
     SORTDBF         Sort data base file
     TAAARC          TAA Archive

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

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

   CRTQSYSMSF    *CMD                   TAASYTY       QATTCMD
   DLTQSYSMSF    *CMD                   TAASYTY2      QATTCMD
   RMVQSYSMSG    *CMD                   TAASYTY3      QATTCMD
   DSPQSYSMSG    *CMD                   TAASYTY4      QATTCMD
   MTNQSYSMSG    *CMD                   TAASYTY5      QATTCMD
   TAASYTYC      *PGM       CLP         TAASYTYC      QATTCL
   TAASYTYC2     *PGM       CLP         TAASYTYC2     QATTCL
   TAASYTYC3     *PGM       CLP         TAASYTYC3     QATTCL
   TAASYTYC4     *PGM       CLP         TAASYTYC4     QATTCL
   TAASYTYC5     *PGM       CLP         TAASYTYC5     QATTCL
   TAASYTYC13    *PGM       CLP         TAASYTYC13    QATTCL
   TAASYTYR3     *PGM       RPG         TAASYTYR3     QATTRPG
   TAASYTYR4     *PGM       RPG         TAASYTYR4     QATTRPG
   TAASYTYR5     *PGM       RPG         TAASYTYR5     QATTRPG
   TAASYTYP      *FILE      PF          TAASYTYP      QATTDDS
   TAASYTYQ      *FILE      PF

The TAASYTYQ file exists  only in TAAWORK during the  use of MTNQSYSMSG
and is created from TAASYTYP.

Structure
---------

CRTQSYSMSF  Cmd
   TAASYTYC   CL pgm

DLTQSYSMSF  Cmd
   TAASYTYC2  CL pgm

RMVQSYSMSG  Cmd
   TAASYTYC3  CL pgm
     TAASYTYR3  RPG pgm
       TAASYTYC13  CL pgm - Removes messages

DSPQSYSMSG  Cmd
   TAASYTYC4  CL pgm
     TAASYTYR4  RPG pgm

MTNQSYSMSG  Cmd
   TAASYTYC5  CL pgm
     TAASYTYR5  RPG pgm
					

Added to TAA Productivity tools July 15, 2010


Home Page Up to Top