Clients testing date related macros for dates where the YY year value is "01" have reported unexpected results. This is due to the interpretation of the THRESHOLD parameter in the date related macros. The following discussion is intended to provide an example of that type of processing, and to explain how THRESHOLD affects output.
Easytrieve Plus distributes date related macros called DATECONV and DATEVAL. These two macros have default thresholds of "00".
THRESHOLD value
This optional parameter establishes the upper end of a 100-year range in the 20th and 21st centuries, used in converting YY to CCYY.
For example, if THRESHOLD is 40, the lower boundary is 1941 and the upper boundary of the range is set to 2040. When converting YY to CCYY, each year is assigned a two-position century, based on the range established by THRESHOLD. The default value for THRESHOLD is 0. This causes all dates to have a range of 1901 through 2000.
If year is 52 when THRESHOLD is 40, century is 19; if year is 21, century is 20.
Valid values for THRESHOLD are 0 through 99.
Panaudit Plus and Easytrieve Plus Toolkit clients also receive those two macros via their products, along with other date related macros that have THRESHOLD parameters that default to "00", (except for the WEEKDAY macro, whose THRESHOLD defaults to 39).
The following is an illustration using DATECONV. To summarize: if a five or six digit date is input, and that date's year value is at or below the threshold, the century will be interpreted as "20". If the year value input is above the threshold, the century will be interpreted as "19". The only valid Julian format is YYDDD.
Program:
DEFINE W-DTE-MMDDCCYY W 8 N
DEFINE W-DTE-YYDDD W 5 N VALUE 01034
*
JOB INPUT NULL
*
%DATECONV W-DTE-YYDDD YYDDD W-DTE-MMDDCCYY MMDDCCYY
DISPLAY 'USING %DATECONV W-DTE-YYDDD YYDDD W-DTE-MMDDCCYY MMDDCCYY'
DISPLAY '+++1 DATE ABOVE DEFAULT THRESHOLD'
DISPLAY '+++1 IN DATE IS ' W-DTE-YYDDD ', OUT DATE IS ' W-DTE-MMDDCCYY
DISPLAY ' '
*
%DATECONV W-DTE-YYDDD YYDDD W-DTE-MMDDCCYY MMDDCCYY THRESHOLD 50
DISPLAY 'USING %DATECONV W-DTE-YYDDD YYDDD W-DTE-MMDDCCYY MMDDCCYY +
THRESHOLD 50'
DISPLAY '+++2 DATE BELOW SPECIFIED THRESHOLD'
DISPLAY '+++2 IN DATE IS ' W-DTE-YYDDD ', OUT DATE IS ' W-DTE-MMDDCCYY
DISPLAY ' '
*
STOP
Output:
USING %DATECONV W-DTE-YYDDD YYDDD W-DTE-MMDDCCYY MMDDCCYY
+++1 DATE ABOVE DEFAULT THRESHOLD
+++1 IN DATE IS 01034, OUT DATE IS 02031901
USING %DATECONV W-DTE-YYDDD YYDDD W-DTE-MMDDCCYY MMDDCCYY
THRESHOLD 50
+++2 DATE BELOW SPECIFIED THRESHOLD
+++2 IN DATE IS 01034, OUT DATE IS 02032001
Broadcom recommends controlling the interpretation of a two digit year via the THRESHOLD parameter as discussed above. Although it is not recommended that date related macros be modified, (and such changes could cause unpredictable results), some clients have preferred to edit date related macros to modify the hard-coded THRESHOLD.