Y4JULIAN takes a date value with the patter 'YYDDD' and returns
the date value with the two-digit year widened to a four-digit year.
 >>-Y4JULIAN(d-+----+-)-----------------------------------------><
'-,w-'
|
- d
- A string expression representing a date. The length of d must
be at least 5. If it is larger than 5, 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(7) NONVARYING and
is calculated as follows:
dcl y2 pic'99';
dcl y4 pic'9999';
dcl c 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) );
Y4JULIAN('99001',1950) returns '1999001'
Y4JULIAN('00001',1950) returns '2000001'.
|
This information center is powered by Eclipse technology. (http://www.eclipse.org)