Overriding the Default Date Window Using the DATTIM PROCESS Statement Option
Sometimes you may not be able to avoid moving dates between 4-digit and 2-digit years, and you know that inaccuracy will result based on the default windowing algorithm that ILE COBOL uses. You can use the DATTIM process statement option to change the default date window.
- 4-digit base century
- This must be the first argument. Defines the base century that ILE COBOL uses
for its windowing algorithm. If the DATTIM process statement option is not
specified, 1900 is used.
The 4-digit-base-century also affects the interpretation of the
@C
conversion specifier. The@C
conversion specifier represents a 1-digit century, whose value ranges between 0 and 9. A 0 for a 1-digit century represents a base century of 1900, 1 = 2000, … 9 = 2800. So, a date data item whose format is@C/%y/%m
and whose value is1/12/05
, represents year 2012, the first day of month 5 (May). However, 0 of @C is really equal to the 4-digit base century. Thus, a DATTIM(2200, 40) would cause 0 = 2200, 1 = 2300 …, 9 = 3100. - 2-digit base year
- This must be the second argument. Defines the base year that ILE COBOL uses for its windowing algorithm. If the DATTIM process statement option is not specified, 40 is used.
- Specifying DATTIM(1900 70) would result in a 100-year window of 1970 through 2069
- If we assume that all 2-digit years are in the 21st century we could specify DATTIM(2000 00), which would result in a 100-year window of 2000 through 2099.
date2 =2039/07/12
date3 =39/07/12
date2 =2040/07/12
The only change in the output is the result of move 3 .
If you remember from the previous example, the output was date2 =1940/07/12
, which was an inaccurate result from moving an updated 2-digit date
to a 4-digit date based on the default ILE COBOL windowing algorithm (base century
of 1900 and base year of 40).