TAA Tools
EXPFIL          EXPIRE FILE                            TAADBOB

The Expire File tool is  a series of commands that allow you  to set an
expiration  date  for a  file  of any  type.   The  system  supports an
expiration  date  for  members,  but  not for  files.    You  must have
*ALLOBJ authority to use any of the commands in the EXPFIL tool.

Once the EXPFIL tool is setup  and file records have been added  to the
EXPFILP file,  you can use the  DLTEXPFIL command directly or  set up a
job  scheduling job to  run the  command one or  more times  per day to
delete expired files.

Note that  adding records  to the  EXPFILP file  will  not cause  their
deletion.   The  file contains  the  file names  and expiration  dates.
The  DLTEXPFIL command  must be  run to  both delete  the file  and the
file record in EXPFILP.

Getting started with EXPFIL
---------------------------

  **   To try  out the  tool, it  is recommended  that you  create  two
       test files in one of your libraries to try the function.

              CRTPF    FILE(xxx/FILE1) RCDLEN(50)
              CRTPF    FILE(xxx/FILE2) RCDLEN(50)

  **   The  EXPFIL  tool   requires  files  in  QGPL  to   contain  the
       expiration information.  Create the files with:

              CRTEXPFILD

       The  files  EXPFILP, EXPFIL,  and  EXPFILM  will  be created  in
       QGPL.  *PUBLIC *EXCLUDE is specified for all of the files.

  **   Use  the ADDEXPFIL  command and  name the  two test files.   Set
       the first file to expire  today (EXPDAYS = 0) and the  second to
       expire in 2 days (EXPDAYS = 2):

              ADDEXPFIL  FILE(xxx/FILE1) EXPDAYS(0)
              ADDEXPFIL  FILE(xxx/FILE2) EXPDAYS(2)

       Any *FILE  object may  be named.   The ADDEXPFIL  command allows
       either  a specific  expiration date or  the number  of days from
       the current  date.   This  allows  you  to include  a  ADDEXPFIL
       command in  a program  that creates  a file  that should  expire
       after some time.

  **   Use the  WRK command to see the files  that are now specified to
       expire:

              WRKEXPFIL

       If the current date is greater  than or equal to the  expiration
       date of  the  file, an  ** will  appear in  the ''Exp''  column.
       This  provides a  good review  of what  will  be deleted  if the
       DLTEXPFIL command is run.

       The F6 key may be used to prompt for the ADDEXPFIL command.

       The  WRKEXPFIL  display  also  has typical  options  to  allow a
       change of  an expiration  date or a  delete option  to delete  a
       file  record.   You may  also copy,  display, or  rename  a file
       record.

  **   Run the DLTEXPFIL command:

             DLTEXPFIL

       The  file records are processed in expiration  date order.  If a
       file expiration date  matches todays date (or  is in the  past),
       the file  will be deleted  and noted on  the listing.   The file
       record is then deleted in the EXPFILP file.

       Assuming  you followed  the previous  step  to create  FILE1 and
       FILE2, you  should see  that FILE1  has been  deleted and  FILE2
       will remain for 2 more days.

       The DLTEXPFIL command allows you to list:

          -  All files
          -  Only the deleted files
          -  Bypass the listing

       Bypassing the listing  may be used  to avoid clutter if  you are
       are running  the DLTEXPFIL command  one or more times  a day and
       have gained confidence in how the tool works.

Running DLTEXPFIL from the job scheduler
----------------------------------------

You  must use  an *ALLOBJ  user profile to  enter the  command to allow
the job schedule  job to run under  your authority.  A  typical command
to add to  the job scheduler that  would cause the job to  be run every
day of the week at the same time would be:

             ADDJOBSCDE JOB(DLTEXPFIL) CMD(DLTEXPFIL)
                          FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*ALL)
                          SCDTIME(nnnnnn) JOBQ(QSYSNOMAX)
                          TEXT('TAA Tool to delete expired files')

Specify  a time for  the command to  run.  Typically, this  would be at
the end of the work day.

Expiring a structure of physical and dependent logical files
------------------------------------------------------------

You can name both physical and  logical files that make up a data  base
structure  to expire  on the  same date.    However, all  files in  the
structure must be in the same library.

The sequence of the file records in the processed file is:

              Expiration date (CYMD field)
              Library name
              Object type (LFs appear before PFs)
              File name

Security considerations
-----------------------

All  commands require  that the  user  have *ALLOBJ  special authority.
This avoids  errors where  a *PUBLIC  user might  accidentally enter  a
command to cause a master file to expire.

Any of the  commands may use adopted  authority to act like  an *ALLOBJ
user.

The physical  and logical files are all  specified as *PUBLIC *EXCLUDE.

You may choose to journal the EXPFILP file as well.

ADDEXPFIL escape messages you can monitor for
---------------------------------------------

      TAA9891    The file already exists in EXPFILP.

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

DLTEXPFIL escape messages you can monitor for
---------------------------------------------

      TAA9892    An error occurred.  See spooled file.
                   Only occurs if command is run in batch

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

Other EXPFIL command escape messages
------------------------------------

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

CRTEXPFILD Command parameters                         *CMD
-----------------------------

   SRCLIB        The  source  library  to  use  for  the  QATTDDS  file
                 source.   The default  is  *TAAARC to  use the  source
                 from the TAA Archive.

                 A specific  user library may be named,  but the source
                 file must be QATTDDS.


DLTEXPFILD Command parameters                         *CMD
-----------------------------

The command has no parameters.


WRKEXPFIL Command parameters                          *CMD
----------------------------

The command has no parameters.


ADDEXPFIL Command parameters                          *CMD
----------------------------

   FILE          The  qualified name  of  the file  to be  deleted when
                 the expiration date  is reached.   Any  file type  may
                 be  named.   Note that  the  deletion is  done by  the
                 DLTEXPFIL command.

                 The  library qualifier defaults to  *LIBL.  A specific
                 library or *CURLIB may also be specified.

   EXPDATE       Either an  expiration  date  or  the  number  of  days
                 before  expiring  must  be  entered   in  the  EXPDAYS
                 parameter.

                 The  default is  *NONE meaning  the  EXPDAYS parameter
                 will be used.

                 If  a date  is entered,  job format  must be  used and
                 the date cannot be in the past.

   EXPDAYS       Either  the number  of  days  after the  current  date
                 before  expiring must  be entered  or a  specific date
                 in the EXPDATE parameter.

                 The  default is  *NONE  meaning the  EXPDATE parameter
                 is used

                 If a  number  of days  is entered,  it  must be  in  a
                 range of 0 to 8000.


DLTEXPFIL Command parameters                          *CMD
----------------------------

   LISTTYPE      The type of listing if any to be output.

                 *ALL  is  the  default  to list  all  records  in  the
                 EXPFILP file.   If a file is  expired according to the
                 expiration date, the  file is deleted  and flagged  on
                 the listing.  The file record is also deleted.

                 *DELETED may  be specified  to list  only those  files
                 that have been deleted.

                 *DELETED2  may be specified  to list only  those files
                 that  have been deleted, but  if none are deleted, the
                 spooled file is deleted.

                 *NONE may  be specified to  bypass the  listing.   Any
                 expired  files  are deleted  and  the  file record  is
                 also  deleted.    This  option  allows  you  to  avoid
                 clutter  of  spooled  files   once  you  have   gained
                 confidence in the tool.

                 If errors exist  (such as the file to  be deleted does
                 not  exist or  is locked),  they  are reported  on the
                 listing and  an escape  message  will occur  when  all
                 file  records have  been  processed.   If  LISTTYPE  =
                 *DELETED  or  *DELETED2  is  specified  and  an  error
                 occurs,  the  listing  is  forced  beginning  with the
                 file record in error.   An escape message  occurs when
                 all file records have been processed.

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

You  must  have  *ALLOBJ  special   authority  to  use  any  of  EXPFIL
commands.

If  both a physical  and dependent logical  files should  expire on the
same day, all files in the structure must be in the same library.

The EXPFIL files must exist in QGPL.

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

The following TAA Tools must be on your system:

     ADDDAT2         Add date 2
     CHKALLOBJ       Check *ALLOBJ special authority
     CHKOBJ2         Check object 2
     CHKOBJ3         Check object 3
     CPYTAADDS       Copy TAA DDS source
     EDTVAR          Edit variable
     RPGSTSDS        RPG status data structure
     RSNLSTMSG       Resend last message
     RTVDAT          Retrieve date
     RTVPGMSTK2      Retrieve program stack 2
     RTVSYSVAL3      Retrieve system value 3
     SNDCOMPMSG      Send completion message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message
     WRTSRC          Write source

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

None, the tool is ready to use.

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

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

   CRTEXPFILD    *CMD                   TAADBOB       QATTCMD
   DLTEXPFILD    *CMD                   TAADBOB2      QATTCMD
   WRKEXPFIL     *CMD                   TAADBOB3      QATTCMD
   ADDEXPFIL     *CMD                   TAADBOB4      QATTCMD
   DLTEXPFIL     *CMD                   TAADBOB5      QATTCMD
   TAADBOBC      *PGM                   TAADBOBC      QATTCL
   TAADBOBC2     *PGM                   TAADBOBC2     QATTCL
   TAADBOBC3     *PGM                   TAADBOBC3     QATTCL
   TAADBOBC4     *PGM                   TAADBOBC4     QATTCL
   TAADBOBC5     *PGM                   TAADBOBC5     QATTCL
   TAADBOBC13    *PGM                   TAADBOBC13    QATTCL
   TAADBOBC15    *PGM                   TAADBOBC15    QATTCL
   TAADBOBR3     *PGM       RPG         TAADBOBR3     QATTRPG
   TAADBOBR4     *PGM       RPG         TAADBOBR4     QATTRPG
   TAADBOBR5     *PGM       RPG         TAADBOBR5     QATTRPG
   TAADBOBD      *FILE      DSPF        TAADBOBD      QATTDDS
   TAADBOBL      *FILE      LF          TAADBOBL      QATTDDS
   TAADBOBM      *FILE      LF          TAADBOBM      QATTDDS
   TAADBOBP      *FILE      LF          TAADBOBP      QATTDDS

Structure
---------

CRTEXPFILD  Cmd
   TAADBOBC   CL pgm

DLTEXPFILD  Cmd
   TAADBOBC2  CL pgm

WRKEXPFIL   Cmd
   TAADBOBC3   CL pgm
     TAADBOBR3   RPG Pgm
     TAADBOBD    Display file
       TAADBOBC13   CL pgm

ADDEXPFIL   Cmd
   TAADBOBC4   CL pgm
     TAADBOBR4   RPG Pgm

DLTEXPFIL   Cmd
   TAADBOBC5   CL pgm
     TAADBOBR5   RPG Pgm
       TAADBOBC15   CL pgm
					

Added to TAA Productivity tools January 15, 2013


Home Page Up to Top