Where allowed to run:
|
Parameters Examples Error messages |
The Calculate Date/Time Diff (CLDIFF) command calculates the difference (duration) between two date or time values. The two values are the "Older" date value or the "FROM" date parameter and the "Newer" date value or the "TO date parameter. The internal date/time math is performed as follows:
duration = NEWER_DATE - OLDER_DATE;
The calculated duration is returned to the CL variable specified on the RTNVAR (returned duration value) parameter.
The DUR (duration) parameter identifies what type of value is returned. It includes a switch so that the results is returned as an Absolute Value. Meaning its sign is removed. This allows either date to be larger than the other and the same value will be returned 3o the RTNVAR parameter.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FROM | Older date/time | Element list | Required, Positional 1 |
Element 1: Date or time value | Character value, *CURRENT | ||
Element 2: Format (if date) | Character value, *DFT, *JOB, *CYMD, *MDY, *YMD, *DMY, *USA, *EUR, *ISO, *JIS | ||
TO | Later date/time | Element list | Required, Positional 2 |
Element 1: Date or time value | Character value, *CURRENT | ||
Element 2: Format (if date) | Character value, *DFT, *JOB, *CYMD, *MDY, *YMD, *DMY, *USA, *EUR, *ISO, *JIS | ||
RTNVAR | CL var to receive duration | Not restricted | Required, Positional 3 |
DUR | Duration to return | Element list | Optional, Positional 4 |
Element 1: Duration | *DAYS, *DAY, *D, *MONTHS, *MONTH, *M, *YEARS, *YEAR, *Y, *SECONDS, *SECOND, *SECS, *SEC, *S, *MINUTES, *MINUTE, *MINS, *MIN, *MN, *HOURS, *HOUR, *H, *MSECONDS, *MSECOND, *MSECS, *MSEC, *MS | ||
Element 2: Return absolute value | *ABS, *NOABS, *YES, *NO |
Top |
Specifies a Date or Time value used to calculate the duration. Normally this is the EARLIER value but it does not need to be. Specify *ABS option on the DUR parameter to remove the sign of the returned duration value.
This is a required parameter.
Top |
Specifies a date or time value used to calculate the duration. Normally this is the later/newer value but it doesn't need to be. If this value is a date and it should be specified as in *JOB or *CYMD format, unless the date format porition of this parameter is also specified.
This is a required parameter.
Top |
Specifies CL variable that receives the duration.
This is a required parameter.
Top |
Specifies the duration code that controls what calculation is performed. When a Date duration is specified, the FROM/TO parameters must contain a valid date value. When a Time duration is specified, the FROM/TO parameters must contain valid time values. To return the duration as a possitive value regarless of the result from the calculation, specify the absolute value option *ABS on the second part of this parameter.
Element 1: Duration
Element 2: Return absolute value
Top |
Top |
Top |