TAA Tools
CMPDAT2         COMPARE DATE 2                         TAADAUW

The  Compare  Date  2  command  provides  a   simple  comparison  of  a
specified date to  the current date plus or minus a  number of days.  A
return  variable that  will contain  GT, LT,  or EQ must  be specified.
The command is very  efficient if the dates  to be compared are in  the
current  year.    CMPDAT2  provides  a  simple  method  of  determining
whether a date is in a range of days from the current date.

A typical series of commands would be:

             DCL        &RTNRES *CHAR LEN(2)
              .
             CMPDAT2    CMPDAT(dddddd) DAYS(30) CMPDATFMT(*xxx)
                          RTNRES(&RTNRES)
             IF         (&RTNRES *EQ 'GT') DO /* CMPDAT is GT */
              .
              .         /* Your processing of GT */
              .
             ENDDO      /* CMPDAT is GT */
             IF         (&RTNRES *EQ 'LT') DO /* CMPDAT is LT */
              .
              .         /* Your processing of LT */
              .
             ENDDO      /* CMPDAT is LT */
             IF         (&RTNRES *EQ 'EQ') DO /* CMPDAT is EQ */
              .
              .         /* Your processing of EQ */
              .
             ENDDO      /* CMPDAT is EQ */

The  command would  determine the  date 30  days in  the future  of the
current date.   If  the CMPDAT  value is  greater  than the  calculated
date, GT would be returned in the RTNRES parameter.

Because  CMPDAT2 is  very efficient  when comparing  a calculated  date
that is  in the same year as the specified  date, it may be effectively
used when a program must make a lot of simple comparisons.

CMPDAT2 escape messages you can monitor for
-------------------------------------------

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

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

   CMPDAT        The date to be compared  to the calculated date.   The
                 format  of the  date is  determined  by the  CMPDATFMT
                 parameter which defaults to *JOB.

   DAYS          The number  of days to add or  subtract to the current
                 system  value  date.   Either  a positive  or negative
                 number may be entered  to calculate a date  further in
                 the  future or  in  the  past.   The  CMPDAT value  is
                 compared to the calculated date.

                 Zero  is valid in  which case the  command will return
                 an EQ  value.  The  value must  be within  a range  of
                 80000 plus or minus.

   CMPDATFMT     The compare date  format.  The default is  *JOB or the
                 setting of the job date format.

                 The  same values  that exist on  CVTDAT such  as *MDY,
                 *YYMD, *USA,  or  *LONGJUL  may be  entered.    For  a
                 complete list, use the prompter facility.

   RTNRES        The  return   result   value  which   is  a   required
                 parameter  and   a  *CHAR  LEN(2)   variable  must  be
                 specified.

                 GT  will be  returned if  the CMPDAT  value is greater
                 than  the   calculated  date   (days  plus/minus   the
                 current system value date).

                 LT will be  returned if the CMPDAT value  is less than
                 the  calculated  date  (days  plus/minus  the  current
                 system value date).

                 EQ will be  returned if the CMPDAT  value is equal  to
                 the  calculated  date  (days  plus/minus  the  current
                 system value date).


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

Because CMPDAT2  returns a variable, the command may  only be used in a
CL program.

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

The following TAA Tools must be on your system:

     ADDDAT2         Add date 2
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message

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

None, the tool is ready to use.

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

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

   CMPDAT2       *CMD                   TAADAUW       QATTCMD
   TAADAUWC      *PGM       CLP         TAADAUWC      QATTCL
					

Added to TAA Productivity tools January 15, 2013


Home Page Up to Top