The Calculate Date Difference 3 command determines the number of days
between 2 dates. The date formats of the From and To dates may
differ in format and all date formats are supported. The two dates
must be valid and the From date must be less than or equal the To
date. CLCDATDIF3 allows any date formats to be input.
A typical command would be:
DCL &NBROFDAYS *DEC LEN(7 0)
.
CLCDATDIF3 FROMDATE('01082005') TODATE('03072006')
FROMFMT(*MDYY) NBROFDAYS(&NBROFDAYS)
The Number of Days returned would be 788. The standard date formats
may be used.
The CVTDAT2 TAA command is used internally to allow dates in the
range of 1600 to 4000. If a 2 digit year date is input, years
1940-2039 are assumed.
CLCDATDIF3 escape messages you can monitor for
----------------------------------------------
None. Escape messages from based on functions will be re-sent.
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.
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. The variable must be declared as *DEC LEN(7
0).
Restrictions
------------
Because the command returns values, it may only be used in a CL
program.
Prerequisites
-------------
The following TAA Tools must be on your system:
CVTDAT2 Convert date 2
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CVTDAT2 *CMD TAADAUA QATTCMD
TAADAUAC *PGM CLP TAADAUAC QATTCL
|