Y4YEAR
Y4YEAR takes a date value with the pattern 'YY'
and
returns the date value with the two-digit year widened to a four-digit
year.
- d
- A string expression representing a date. The length of d must
be at least 2. If it is larger than 2, excess characters must be formed
by leading blanks.
d must have computational type and should have character type. If not, it is converted to character.
- w
- Specifies an expression (such as 1950) that can be converted to an integer. If negative, it specifies an offset to be subtracted from the value of the year when the code runs. If omitted, w defaults to the value specified in the WINDOW compile-time option.
The returned value has the attributes CHAR(4) NONVARYING and is
calculated as follows:
dcl y2 pic'99';
dcl y4 pic'9999';
dcl c pic'99';
y2 = d;
cc = w/100;
if y2 < mod(w,100) then
y4 = 100*cc + 100 + y2;
else
y4 = 100*cc + y2;
return( y4 );
Y4YEAR('99',1950)
returns '1999'Y4YEAR('00',1950)
returns '2000'