TAA Tools
CLCTIMDIF      CALCULATE TIME DIFFERENCE                  TAATIMC

In some applications,  you want to wait  until a specific time  of day.
Many  of the  commands that  cause  a wait  normally want  to  know the
number  of  seconds to  wait.   The CLCTIMDIF  command  can be  used to
determine how long to wait.

The Calculate Time  Difference command  calculates the time  difference
in seconds  between two times.   By default, both times  must be within
the  same  day and  the FROMTIME  must  be less  than  the TOTIME.   An
option exists to allow the From Time to be in the previous day.

The time values specified should be  in military time (e.g.  130000  is
1:00 PM) for hhmmss.

A typical command would appear as:

       CLCTIMDIF    FROMTIME(113000) TOTIME(133000) SECONDS(&SECONDS)

The &SECONDS  variable is a  return variable  on the command  and would
contain  the number  of seconds  in character form.   In  this example,
there is a two hour difference or 7200 seconds.

If ALWFROMGT(*YES) is  specified and the  From Time is GT  than the  To
time,  the From  time  is  assumed  to be  in  the  previous day.    To
determine the  difference, 86,400 seconds  (24 x 3600) is  added to the
To  Time.   Note that  there is  no harm in  specifying ALWFROMGT(*YES)
when the  From time is  LT the To  Time.  The  86,400 increase is  only
added if the From time is GT.

CLCTIMDIF escape messages you can monitor for
---------------------------------------------

      CPF9898    ALWFROMGT(*NO) was specified and the From time is GT

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

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

   FROMTIME      The  'from time'  to be  used.   The time  must  be in
                 military  time (e.g.   1:00 PM is 130000).   The value
                 must be in  character form of length  6 (hhmmss).   If
                 midnight is needed, specify 000000.

                 If ALWFROMGT(*NO)  is specified  (it is  the default),
                 the FROMTIME must be less than the TOTIME.

                 If ALWFROMGT(*YES)  is specified and the  From Time is
                 GT the TOTIME, the From time  is assumed to be in  the
                 previous day.

   TOTIME        The  'to time'  to  be  used.   The  time must  be  in
                 military time  (e.g.  1:00  PM is 130000).   The value
                 must  be in character  form of length  6 (hhmmss).  If
                 midnight is needed, specify 240000.

   SECONDS       The required  return variable which  will contain  the
                 difference  in   number  of  seconds.     It  must  be
                 declared as *CHAR LEN(5).

   ALWFROMGT     Whether  to allow the From Time  to be in the previous
                 day.  *NO  is the  default.   If the From  time is  GT
                 than  the  To  time,  CPF9898 is  sent  as  an  escape
                 message.

                 If  *YES is  specified and  the From  time is  GT than
                 the To time,  the From time  is assumed to  be in  the
                 previous day.   86,400  seconds (24  x 3600) is  added
                 to  the To  time to  determine  the difference.   Note
                 that  there is  no harm  in specifying ALWFROMGT(*YES)
                 when the  From time  is LT the  To Time.   The  86,400
                 increase is only added if the From time is GT.

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

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

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

None.

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

None, the tool is ready to use.

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

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

   CLCTIMDIF     *CMD                      TAATIMC        QATTCMD
   TAATIMCC      *PGM          CLP         TAATIMCC       QATTCL
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top