The YEAR-TO-YYYY function converts argument-1, the two low-order digits of a year, to a four-digit year. Argument-2, when
added to the year at the time of execution, defines the ending year of a 100-year interval, or sliding window, into which
the year of argument-1 falls. The type of this function is integer.
FUNCTION YEAR-TO-YYYY ( argument-1 [argument-2] )
- Argument-1 must be a nonnegative integer less than 100.
- Argument-2 must be an integer.
- If argument-2 is omitted, the function is evaluated as though 50 were specified.
- The sum of the year at the time of execution and the value of argument-2 must be less than 10,000 and greater than 1699.
- Maximum-year is calculated as follows:
(FUNCTION NUMVAL (FUNCTION CURRENT-DATE (1:4)) + argument-2)
where argument-2 of the NUMVAL function is the same as argument-2 of the YEAR-TO-YYYY function itself.
- The equivalent arithmetic expression is:
- When the following condition is true:
FUNCTION MOD (maximum-year, 100) > = argument-1
The equivalent arithmetic expression is:
(argument-1 + 100 * (FUNCTION INTEGER (maximum-year/100)))
- Otherwise, the equivalent arithmetic expression is:
(argument-1 + 100 * (FUNCTION INTEGER (maximum-year/100) - 1))