TAA Tools
CLCDATTIM2      CALCULATE DATE/TIME 2                  TAATINT

The Calculate Date/Time  2 command returns  the difference in  terms of
number  of minutes  (and optionally  the number  of seconds)  between a
From  date/time  and a  To date/time.   CLCDATTIM2  may be  useful when
determining time differences.

CLCDATTIM2 differs from  CLCDATTIM.  CLCDATTIM  returns a new date  and
time after  adding a number  of hours and  minutes to a  specified date
and time.

A typical series of commands for CLCDATTIM2 would be:

             DCL        &MIN *DEC LEN(10 0)
             DCL        &SEC *DEC LEN(2 0)
              .
             CLCDATTIM2 FROMDATE(&fff) FROMTIME(&ggg)
                          TODATE(&ttt) TOTIME(&uuu)
                          RTNMIN(&MIN) RTNSEC(&RTNSEC)

If  both  the FROMDATE  and  TODATE parameters  are the  same  date and
FROMTIME = 010005 and TOTIME =  021215, the RTNMIN value would be -  72
and the RTNSEC value would be - 10.

The  special value  *TODAY  may  be used  for  either  or both  of  the
FROMDATE/TODATE  parameters.   The special value  *CURRENT may  be used
for either or both of the FROMTIME/TOTIME parameters.

The  FROMDATE/FROMTIME  value  must  be  less  than  or  equal  to  the
TODATE/TOTIME value unless ALWFROMGT(*YES) is specified.

CLCDATTIM2 escape messages you can monitor for
----------------------------------------------

      TAA9891    Negative value and ALWFROMGT(*NO)
      TAA9892    Number of days exceeds 25,000.

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

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

   FROMDATE      The From date specified  in job format.  A  valid date
                 must  be entered or  the special value  *TODAY meaning
                 the current date.

                 All  2 digit year dates  must be in a  range of Jan 1,
                 1940 to  Dec 31, 2039.   All 4  digit year dates  must
                 be in a range of Aug 24, 1928 to May 9, 2071.

   FROMTIME      The  From time specified  in HHMMSS  format.   A valid
                 time  (000000   -  235959)  must  be  entered  or  the
                 special value *CURRENT meaning the current time.

   TODATE        The To date  specified in  job format.   A valid  date
                 must be  entered or the  special value  *TODAY meaning
                 the current date.

                 All 2  digit year dates must  be in a range  of Jan 1,
                 1940 to Dec  31, 2039.   All 4 digit  year dates  must
                 be in a range of Aug 24, 1928 to May 9, 2071.

   TOTIME        The  To time  specified  in HHMMSS  format.   A  valid
                 time  (000000  -   235959)  must  be  entered  or  the
                 special value *CURRENT meaning the current time.

   ALWFROMGT     A   *YES/*NO  value  that  determines  whether  either
                 date/time value can be *GT than the other value.

                 *NO  is  the  default.    If  the  From  Date/Time  is
                 greater  than the  To Date/Time  an escape  message is
                 issued unless ALWFROMGT(*YES) is specified.

                 *YES  may  be  specified  to  allow  either  Date/Time
                 value to  be  greater  than  the other.    A  positive
                 value  is  always  returned.    See  also  the  NEGVAL
                 keyword.

   RTNMIN        The  number of minutes between  the From date/time and
                 the To  date/time.    The value  is  always  positive.
                 This  is   a  required  return   value  and   must  be
                 specified ad *DEC LEN(10 0).

   RTNSEC        The  remainder  number  of  seconds between  the  From
                 date/time  and the  To date/time  after the  number of
                 minutes has  been calculated.   The  value will  never
                 be  greater than  59  and will  always  be a  positive
                 value.   This is an optional  return value and must be
                 specified as *DEC LEN(2 0).

   NEGVAL        The   RTNMIN   value   is   always   positive.      If
                 ALWFROMGT(*YES)  is   specified  and   the  value   is
                 negative  (because  the From  date/Time  is  GT), *YES
                 will be returned.   Otherwise *NO  is returned.   This
                 is an optional  return value and must be  specified as
                 *CHAR LEN(4).

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

The  From Date/Time  cannot  be greater  than the  To  Date/Time unless
ALWFROMGT(*YES) is specified.

The  number of  days between  the From Date  and To  date cannot exceed
25,000.

Because CLCDATTIM2 returns variables,  the command may only be  used in
a CL program.

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

The following TAA Tools must be on your system:

     CLCDATDIF3      Calculate date difference 3
     CVTTIMSEC       Convert time to seconds
     DIVIDE          Divide
     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
   ------        ----    ---------      ----------    ----------

   CLCDATTIM2    *CMD                   TAATINT       QATTCMD
   TAATINTC      *PGM       CLP         TAATINTC      QATTCL
					

Added to TAA Productivity tools April 15, 2010


Home Page Up to Top