To define how a date with a two-digit year (YY) is interpreted, a century window is defined using the WINDOW compile-time option. As described previously, the century window defines the beginning of a 100-year span to which the two-digit year applies.
Without the help of PL/I's Millennium Language Extensions, you would have to implement something like the following logic which converts y2 from a two-digit year to a four-digit year with a window (w).
dcl y4 pic'9999';
dcl cc pic'99';
cc = w/100;
if y2 < mod(w,100) then
y4 = (100 * cc) + 100 + y2;
else
y4 = (100 * cc) + y2;Using this example, if you were to specify WINDOW(1900), 19 would be interpreted as the year 1919. If you were to specify WINDOW(1950), however, 19 would be interpreted as the year 2019.
Conversely, this logic calculates the two-digit year (y2) when converting from a four-digit year.
dcl y4 pic'9999';
if y4 < w | y4 >= w + 100 then
signal error;
y2 = mod(y4,100);