TAA Tools
CLCDATDIF       CALCULATE DATE DIFFERENCE              TAADATH

The Calculate  Date Difference command  takes two dates  and determines
how many  days exist between.   Leap years  are provided for.   Century
may be specified.

A typical command would be:

     CLCDATDIF      FROMDATE(&FROM) TODATE(&TO)
                      NBROFDAYS(&DAYS) FORMAT(*MDY)

The  command would determine  the number of days  between the two dates
and pass back the answer in the NBROFDAYS parameter.

Because CLCDATDIF provides a return  parameter, it can only be  used in
a CL program.

The From  and To  dates only support  6 digit dates.   The  default for
determining  the century  is  based on  years 40-99  being in  the 20th
century and years  00-39 being in the  21st century.   The From and  To
Century values  may be  used to  allow for dates  ranging from  1900 to
2899.

See the CLCDATDIF3 command for the handling of other date formats.

The  CPP (TAADATHC) can  be called  directly.  The  following parameter
list must be used with NBRDYS as the return value.

       FROMDATE    *CHAR LEN(6)
       TODATE      *CHAR LEN(6)
       NBRDAYS     *DEC LEN(7 0)
       FORMAT      *CHAR LEN(7)     left adjust the value
       FRMCEN      *CHAR LEN(1)
       TOCEN       *CHAR LEN(1)

The following  is RPG  code which  describes a  typical example.    The
code is in  the proper format  to be copied into  an RPG program.   Use
CPYTAA   TAAARCMBR(CLCDATDIF)   to    copy   the   source   from   this
documentation member to the QATTINFO source file in TAATOOL.

     C* Initialize fields for CLCDATDIF CPP
     C*   The program will determine how many days exist from some
     C*     date in the past to the current date (UDATE).
     C*       (Note the MOVEL for the FORMAT value)
     C                     MOVEL'*MDY'    FORMAT           Date format
     C                     MOVE UDATE     TODAT            Curr date
     C                     MOVE '*'       FRMCEN           From century
     C                     MOVE '*'       TOCEN            To century
     .
     .
     C* Move the FROMDATE to FRMDAT
     C                     CALL 'TAADATHC'                 CLCDATDIF
     C                     PARM           FRMDAT  6        From date
     C                     PARM           TODAT   6        To date
     C                     PARM           NBRDYS  70       Nbr of days
     C                     PARM           FORMAT  7        Date format
     C                     PARM           FRMCEN  1        From century
     C                     PARM           TOCEN   1        To century

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

   FROMDATE      The  'from  date' to  be  used.   If  a digit  date is
                 entered, it  must be  in the format  described by  the
                 FORMAT parameter.

                 The  special value  *TODAY  may be  used  to mean  the
                 system  date.    It will  be  converted  based  on the
                 system value  for date  format (the  FORMAT  parameter
                 is ignored).

   TODATE        The 'to  date' to be used.   The 'to  date' (including
                 the  century)  cannot be  less than  the  'from date'.
                 If a digit date is entered,  it must be in the  format
                 described by the FORMAT parameter.

                 The  special value  *TODAY  may be  used  to mean  the
                 system  date.    It will  be  converted  based on  the
                 system  value  for date  format (the  FORMAT parameter
                 is ignored).

   NBROFDAYS     The return  value  which will  contain the  number  of
                 days.   It must  be declared  as *DEC  LEN(7 0).   The
                 dates  are  converted  to  a  common  format  and then
                 subtracted.  Therefore, if the  dates are the same,  a
                 0  will be  returned.   If 050101  is subtracted  from
                 050130, the answer will be 29.

   FORMAT        The  format of the date  fields.  Both  fields must be
                 in the same format.   The default  is *JOB meaning  to
                 use the job date  format.  The other values  are *MDY,
                 *DMY, *YMD, and *SYSVAL.

                 For  other date formats,  see the  CLCDATDIF3 command.

   FROMCEN       The  century of the  'from date'.   '*' is the default
                 meaning the  century is determined  based on the  year
                 of the  FROMDATE (40-99 =  20th century, 00-39  = 21st
                 century).

   TOCEN         The  century of  the 'to  date'.   '*' is  the default
                 meaning the century  is determined  based on the  year
                 of  the TODATE  (40-99 =  20th century,  00-39 =  21st
                 century).

                 The  valid values  which can  be entered  are are  0 =
                 20th century,  1  =  21st  century,  ...    9  =  29th
                 century.

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

The command can only be used in a CL program.

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

The following TAA Tools must be on your system:

         CVTDAT2       Convert date 2
         SNDESCMSG     Send escape message

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

None, the tool is ready to use.

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

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

   CLCDATDIF     *CMD                       TAADATH       QATTCMD
   TAADATHC      *PGM           CLP         TAADATHC      QATTCL
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top