TAA Tools
CHKDBFDAT       CHECK DATA BASE FILE DATE              TAADATN

The Check Data  Base File Date command  checks one or more  date fields
in  a  file for  valid  dates.   A  spooled file  is  created with  any
errors.   The data base  file must be externally  described.  A variety
of date formats  can be specified such  as MMDDYY, DDMMYYYY, ISO,  USA,
etc.

A typical command would be:

             CHKDBFDAT   FILE(xxx) DATFMT(*MDY6)

The  default  for  the  DATEFIELD  parameter is  *PROMPT.    Using  the
default,  you would see a subfile  of the fields in  the named file and
would select  the date  fields to  be checked  (all must  be in  MMDDYY
format to  match the DATFMT  specified).  Up to  10 date fields  can be
selected.

The default  for the IDFIELD parameter is  *PROMPT.  Using the default,
you would see  a subfile  of the  fields in  the named  file and  would
select up  to 3  fields to  help identify  any records in  error.   For
example, if a  unique key existed on the CUST  field, you would want to
specify  CUST as an ID field.   If any errors  occur, the value of CUST
for the record would be  printed along with the name of the  date field
in error and the error value.

When the  command completes, a  message is sent stating  whether errors
were  found or not.  If  one of the *PROMPT  functions was requested, a
request  message  is  sent  and  received  for  the  command   that  is
executed.   This includes  any field  names that  were entered for  the
*PROMPT function.   Thus you can easily dup  the command and re-enter a
different value or format.

Dates are  checked  for such  things  as a  valid  month, a  valid  day
within the month, February  29th is only valid during  leap years, etc.
Options exist to bypass blank/zero dates or dates of all 9s.

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

   FILE          The  qualified file  name of  the  file.   The library
                 value  defaults to *LIBL.   *CURLIB may  also be used.

                 For  the fastest  processing  technique,  specify  the
                 physical  file  (not a  logical  file).    If a  keyed
                 physical  file  is  named,  it  will  be  processed in
                 arrival sequence.

   DATEFIELD     A list of up  to 10 date fields  to be checked.   Each
                 date  field must  have  the same  format as  specified
                 for the DATFMT parameter.

                 The  default  is  *PROMPT.    Using  the default,  you
                 would see  a subfile  of all  the fields  in the  file
                 and may select the date fields to be processed.

                 Only  a  character,  packed, or  zoned  field  may  be
                 specified.

   DATEFMT       The  date  format to  be  checked.   All  dates to  be
                 checked must be of the same format.

                 The  default value  is *SYSVAL which  means the system
                 format  is  used.     The  QDATFMT  system   value  is
                 accessed  and the  current  value  is translated  into
                 one of the values *MDY6, *DMY6, *YMD6, or *JUL5.

                 You  may  also  specify  *MDY6,  *DMY6, *YMD6,  *MDY8,
                 *DMY8,  *YMD8,   *MDYY8,   *DMYY8,   *YYMD8,   *CYMD7,
                 *CYMD9,  *YY,  *MM, *YYMM,  *MMYY,  *MDYY10,  *DMYY10,
                 *YYMD10, *ISO, *USA, *EUR, and *JIS.

                 The  numeric value  on the  end  of the  special value
                 describes the  required  length  of the  field.    For
                 example, *MDY6  requires a length  of 6 in  the format
                 mmddyy.   Either  a  character or  decimal  (packed or
                 zoned)  field is valid for *MDY6.   Some types such as
                 *ISO or *YMD8 can only be character fields.

                 The Y identification  means a 2  character year.   The
                 YY  identification  means a  4  character  year.   For
                 example,  a  *YMD6 value  must  look like  yymmdd.   A
                 *YYMD8 value must look like yyyymmdd.

   DATESEP       The date  separator to  be used  for certain  8 or  10
                 byte  data formats.    All dates  to  be checked  must
                 have the same separator.

                 The  default value is  *SYSVAL which  means the system
                 date separator is used.   The QDATSEP system value  is
                 accessed  and the  current  value is  translated  into
                 one of the supported values.

                 You may  also specify a  '/', '-', ',',  or *BLANK for
                 a blank value.

   ALWBLANKS     A  *YES/*NO  option  for whether  dates  of  blanks or
                 zeros  will be  considered  valid.   Also  checked  is
                 *LOVAL.

                 *NO is  the default  meaning blanks, zeros,  or *LOVAL
                 will be considered errors.

                 *YES  may  be specified  to bypass  blanks,  zeros, or
                 *LOVAL.

   ALW9S         A *YES/*NO option  for whether  dates of  all 9s  will
                 be considered valid.  Also checked is *HIVAL.

                 *NO is  the default meaning all  9s or *HIVAL  will be
                 considered errors.

                 *YES may be specified to bypass all 9s or *HIVAL.

   YRLOWRNG      The low  range of a year to check.   The default is 0.
                 If a value  other than  0 is specified  such as  1990,
                 all years  must be equal  or greater  than 1990.   The
                 check   does   not   occur   if   ALWBLANKS(*YES)   or
                 ALW9S(*YES)  has been  specified and  the date  is all
                 blanks (or zeros) or all 9s.

   YRHIRNG       The high range  of a  year to check.   The default  is
                 9999.   If a value  other than 9999 is  specified such
                 as  2050,  all years  must be  equal  or less  than an
                 2050.   The check  does not  occur if  ALWBLANKS(*YES)
                 or  ALW9S(*YES) has  been  specified and  the date  is
                 all blanks (or zeros) or all 9s.

   IDFIELD       A  list  of  up  to  3  fields  to help  identify  any
                 records in error.

                 The default  is  *PROMPT.    Using  the  default,  you
                 would see  a subfile  of all  the fields  in the  file
                 and  may select up  to 3  fields to help  identify the
                 record in error.

                 For  example,  if a  unique  key existed  on  the CUST
                 field,  you  would want  to  specify  CUST  as  an  ID
                 field.   If any  errors occur, the  value of  CUST for
                 the  record would  be printed  along with the  name of
                 the date field in error and the error value.

                 Only a  character,  packed,  or  zoned  field  may  be
                 specified.

   MBR           The member  to be processed.   The default  is *FIRST.

Date formats supported
----------------------

The  following shows the  various supported  date types and  the values
for July 31, 2009.

                                       Character field
       Date type        Sample             required

        *MDY6           073109
        *DMY6           310709
        *YMD6           090731
        *MDY8           07/31/09              Yes
        *DMY8           31/07/09              Yes
        *YMD8           09/07/31              Yes
        *CYMD7          1090731
        *CYMD9          109/07/31             Yes
        *MDYY8          07312009
        *DMYY8          31072009
        *YYMD8          20090731
        *MDYY10         07/31/2009            Yes
        *DMYY10         31/07/2009            Yes
        *YYMD10         2009/07/31            Yes
        *MM             07
        *YY             09
        *MMYY           0709
        *YYMM           0907
        *ISO10          2009-07-31            Yes
        *USA10          07/31/2009            Yes
        *EUR10          31.07-2009            Yes
        *JIS10          2009-07-31            Yes

The *ISO10,  *USA10, *EUR10,  and  *JIS date  formats have  a  required
separator.  The other  date formats which include a  separator consider
any value to be valid.

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

Only externally described files are supported.

The record length of the file cannot exceed 9999 bytes.

The number of fields in the file cannot exceed 998.

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

The following TAA Tools must be on your system:

     EXPVAL          Expand value
     EXTLST2         Extract list 2
     HLRMVMSG        HLL Remove message
     PMTFLD          Prompt field
     RTVFLDARR       Retrieve field array
     RTVSYSVAL3      Retrieve system value 3
     SNDCOMPMSG      Send completion message
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message

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

None, the tool is ready to use.

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

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

   CHKDBFDAT     *CMD                   TAADATN       QATTCMD
   TAADATNC      *PGM       CLP         TAADATNC      QATTCL
   TAADATNR      *PGM       RPG         TAADATNR      QATTRPG
					

Added to TAA Productivity tools February 1, 1997


Home Page Up to Top