TAA Tools
CLCDAYS         CALCULATE DAYS                         TAADAUH

The Calculate Days  command allows you  to determine how  many specific
days (Sundays,  Mondays ...   Saturdays) exist between two  dates.  You
may  name one or more days in the  week to be considered.  For example,
you can count the number  of Tuesdays and Thursdays that  exist between
two dates (the start and end dates are included).

A typical set of commands would be:

            DCL        &NBRDAYS *DEC LEN(7 0)
             .
            CLCDAYS   STRDATE(xxx) ENDDATE(yyy) SUNDAY(*NO)
                        SATURDAY(*NO) NBRDAYS(&NBRDAYS)

The number of  Mondays, Tuesdays ...  Fridays  would be counted between
the two dates and returned in the &NBRDAYS variable.

Dates  must be entered in job  format.  For example,  if STRDATE has an
MDY value of 010103  and ENDDATE has a value  of 010803, the answer  is
6 days  (010403 is Saturday  and 010503 is Sunday).   Note that  if one
of  the days requested  falls on  either the start  or end date,  it is
counted.

You must specify *YES  for at least  one of the days  of the weeks  and
specify a variable name for the NBRDAYS return variable.

Date restrictions
-----------------

The  STRDATE/ENDDATE parameters  are  coded  in command  definition  as
*DATE type  fields.  This allows  a job format date to  be entered such
as MMDDYY or MMDDYYYY.

However,  the *DATE rules  restrict an 8  digit date to  the same rules
applied to a  2 digit year.   Therefore, not  all possible YYYY  values
are valid.

CLCDAYS escape messages you can monitor for
--------------------------------------------

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

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

   STRDATE       The  start  date  to  consider  in  job  date  format.
                 Either  a two or four digit year  may be entered.  The
                 start date  is  included  in  the  calculation.    The
                 start date cannot  be greater than the  ENDDATE value.

   ENDDATE       The  end date  to consider  in job  date format.   The
                 end date is  included in  the calculation.   Either  a
                 two or four digit year may be entered.

   INCSUN        Whether  to include  Sundays.   The  default is  *YES.
                 *NO may be entered to exclude Sundays.

   INCMON        Whether  to include  Mondays.   The  default  is *YES.
                 *NO may be entered to exclude Mondays.

   INCTUE        Whether  to include  Tuesdays.   The default  is *YES.
                 *NO may be entered to exclude Tuesdays.

   INCWED        Whether to include Wednesdays.   The default is  *YES.
                 *NO may be entered to exclude Wednesdays.

   INCTHU        Whether to  include Thursdays.   The default  is *YES.
                 *NO may be entered to exclude Thursdays.

   INCFRI        Whether  to  include Fridays.   The  default  is *YES.
                 *NO may be entered to exclude Fridays.

   INCSAT        Whether to include  Saturdays.   The default is  *YES.
                 *NO may be entered to exclude Saturdays.

   NBRDAYS       The  number of  days  counted between  the two  dates.
                 The variable must be declared as *DEC LEN(7 0).

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

Only  valid dates according  to the  command definition *DATE  type may
be entered.

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

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

The following TAA Tools must be on your system:

     CLCDATDIF3      Calculate date difference 3
     RTVDAT          Retrieve date
     SNDESCMSG       Send escape message

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

None, the tool is ready to use.

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

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

   CLCDAYS       *CMD                   TAADAUH       QATTCMD
   TAADAUHC      *PGM       CLP         TAADAUHC      QATTCL
					

Added to TAA Productivity tools December 15, 2002


Home Page Up to Top