TAA Tools
CLCDATDIF4      CALCULATE DATE DIFFERENCE 4            TAADAUR

The  Calculate  Date  Difference 4  command  is  like  CLCDATDIF3,  but
allows a  list of one or more  day names to be specified.   This allows
an  answer  to a  question  such as  'How  many Tuesdays  and Thursdays
exist between 2 dates?'

A typical series of commands would be:

             DCL          &DAYS *DEC LEN(7 0)
              .
             CLCDATDIF4   FROMDATE(010109)
                            TODATE(030209)
                            DAYNAM(*TUE *THU)
                            FROMFMT(*MDY)
                            NBROFDAYS(&DAYS)

The &DAYS parameter  is a return variable  and would contain the  value
17.

The first day of  2009 is a Thursday.  If you  specify the first day of
2009  as both the  From and To  date and DAYNAM(*THU),  the answer will
be one.  Unlike  CLCDATDIF3, the number of  days between the two  dates
is considered to be one.

CLCDATDIF4 escape messages you can monitor for
----------------------------------------------

      TAA9892    The From Date must be *GE the To date

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

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

   FROMDATE      The From date.   It must be a valid  date according to
                 the FROMFMT parameter.

                 The  special value *TODAY  may be entered  to mean the
                 system date.    If  *TODAY  is  entered,  the  FROMFMT
                 parameter is ignored  and the date is  converted based
                 on the system date format.

   TODATE        The  To date.   It must be  a valid date  according to
                 the TOFMT parameter.

                 The  special value *TODAY  may be entered  to mean the
                 system  date.    If  *TODAY  is   entered,  the  TOFMT
                 parameter is  ignored and the date  is converted based
                 on the system date format.

   DAYNAM        A  list of one or  more day names such  as *SUN, *MON,
                 ...   *SAT.  *ALL  may be  specified for  all days  of
                 the week.

   FROMFMT       The format  of the  From date.   *JOB  is the  default
                 meaning  the  date  is in  the  format  of the  DATFMT
                 setting of  the job.   Other  values include  *SYSVAL,
                 *MDY,   *DMY,  *YMD,   *MDYY,   *DMYY,  *YYMD,   *JUL,
                 *LONGJUL, *CYMD, *ISO, *USA, *EUR, and *JIS.

   TOFMT         The format  of the To  date.  *FROMFMT  is the default
                 meaning  the  value of  the  FROMFMT parameter.   *JOB
                 may be  specified to mean  the date  is in the  format
                 of  the  DATFMT setting  of  the  job.   Other  values
                 include  *SYSVAL,  *MDY,  *DMY,  *YMD,  *MDYY,  *DMYY,
                 *YYMD, *JUL, *LONGJUL,  *CYMD, *ISO,  *USA, *EUR,  and
                 *JIS.

   NBROFDAYS     The  difference in  number  of  days between  the  two
                 dates.   This is  a required return  variable and must
                 be declared as *DEC LEN(7 0).


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

Because  CLCDATDIF4  returns  a  variable,  the  command  may  only  be
entered into a CL program.

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

The following TAA Tools must be on your system:

     CHKDUPLST       Check duplicate list
     CVTDAT2         Convert date 2
     DIVIDE          Divide
     EXTLST          Extract list
     RTVDAT          Retrieve date
     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
   ------        ----    ---------      ----------    ----------

   CLCDATDIF4    *CMD                   TAADAUR       QATTCMD
   TAADAURC      *PGM       CLP         TAADAURC      QATTCL
					

Added to TAA Productivity tools January 15, 2009


Home Page Up to Top