Y4DATE takes a date value with the patter 'YYMMDD' and returns the date value with the two-digit year widened to a four-digit year.
|
d must have computational type and should have character type. If not, d is converted to character.
The returned value has the attributes CHAR(8) NONVARYING and is calculated as follows:
dcl y2 pic'99';
dcl y4 pic'9999';
dcl cc pic'99';
y2 = substr(d,1,2);
cc = w/100;
if y2 < mod(w,100) then
y4 = 100*cc + 100 + y2;
else
y4 = 100*cc + y2;
return( y4 || substr(d,3) );