ANS85 

The YEAR-TO-YYYY Function

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.

General Format

    FUNCTION YEAR-TO-YYYY ( argument-1 [argument-2] ) 

Arguments

  1. Argument-1 must be a nonnegative integer less than 100.
  2. Argument-2 must be an integer.
  3. If argument-2 is omitted, the function is evaluated as though 50 were specified.
  4. 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.

Returned Values

  1. 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.

  2. The equivalent arithmetic expression is:
    1. 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)))

    2. Otherwise, the equivalent arithmetic expression is:

      (argument-1 + 100 * (FUNCTION INTEGER (maximum-year/100) - 1))

Notes

  1. In the year 1995, the returned value for FUNCTION YEAR-TO-YYYY (4, 23) is 2004. In the year 2008 the returned value for FUNCTION YEAR-TO-YYYY (98, (-15)) is 1898.
  2. The YEAR-TO-YYYY function implements a sliding window algorithm. To use it for a fixed window, argument-2 can be specified as follows, where fixed-maximum-year is the maximum year in the fixed 100-year interval:

    (fixed-maximum-year - FUNCTION NUMVAL (FUNCTION CURRENT-DATE (1:4)))

    If the fixed window is 1973 through 2072, then in 2009 argument-2 has the value 63 and in 2019, the value 53.