TAA Tools
CMPDAT          COMPARE DATE                           TAADATI

The Compare Date command  compares two dates and returns  variables for
the relationship  (GT, LT, EQ) and  the number of days  between the two
dates.  Various formats of the two dates are supported.

A typical use would be:

        DCL         &RTNRES *CHAR LEN(2)
        DCL         &RTNDAYS *DEC LEN(5 0)
         .
         .
        CMPDAT      FROMDAT(&FROMDATE) TODATE(&TODATE)
                      RTNRES(&RTNRES) RTNDAYS(&RTNDAYS)
        IF          (&RTNRES *EQ 'GT') DO /* From date is GT */
                       /* Use &RTNDAYS value */

The  RTNRES value is always relative to  the FROMDATE.  If the FROMDATE
is greater than,  the value  will be GT.   The format  of the dates  is
assumed to be *JOB.  FROMFMT and TOFMT are supported parameters.

The RTNDAYS  value will  always be  positive if the  dates differ.   If
the dates are equal, the RTNRES value is always 0.

A century is assumed for each of the dates entered on the basis of:

         Years 00-39 = 21st century
         Years 40-99 = 20th century

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

   FROMDATE      The   from  date.    It  must   appear  in  the  value
                 specified by  the  FROMFMT parameter.   A  century  is
                 assumed.

   TODATE        The to  date.  It must  appear in the  value specified
                 by the TOFMT parameter.  A century is assumed.

   FROMFMT       The  format  of  the  FROMDATE  value.   *JOB  is  the
                 default.     *SYSVAL   (meaning   the   system   value
                 QDATFMT), *MDY,  *DMY, or  *YMD may  be specified.   A
                 Century is determined

   TOFMT         The  format  of  the   TODATE  value.    *JOB  is  the
                 default.      *SYSVAL   (meaning   the   system  value
                 QDATFMT), *MDY, *DMY, or *YMD may be specified.

   RTNRES        An optional  return value  that must  be specified  as
                 *CHAR LEN(2).   The  value will be  either GT,  LT, or
                 EQ.   The value is  set based on the  FROMDATE (If the
                 FROMDATE is greater  than the  TODATE, the value  will
                 be GT).

   RTNDAYS       An optional  return value  that must  be specified  as
                 *DEC  LEN(5 0).   It will  contain the number  of days
                 between the FROMDATE and the  TODATE.  Leap years  are
                 considered.   If  the  dates  differ, the  value  will
                 always  be positive.   The value  will always be  0 if
                 RTNRES is EQ.

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

The  command supports return  values and therefore can  only be used in
a CL program.

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

The following TAA Tools must be on your system:

     CHKLEAP      Check leap year
     SNDESCMSG    Send escape message

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

None, the tool is ready to use.

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

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

   CMPDAT        *CMD                       TAADATI       QATTCMD
   TAADATIC      *PGM           CLP         TAADATIC      QATTCL
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top