Age Function

Use the Age Function to age values in a source column. The source column can contain character, numeric, date, or timestamp data. A CHAR or VARCHAR column has a maximum length of 256 bytes.

The Age Function is formatted as:

AGE(parameters)

The following is a list of the parameters with valid format and values:

Parameter Format Valid Values
Column Name – Specify the name of the source column if it differs from the destination column. SC=column-name

Column Name
SRCCOL=column-name
Default – Age dates based on the date adjustment value specified in a process request. DEF Uses date adjustment value specified in the process request.
None – Do not age value. NONE Value should not be aged regardless of specifications in the process request.
Incremental – Incremental Aging is based on a known time unit. Optim™ supports date aging in single units (for example 20 years) or multiple units (for example, 2 years, 3 months, 2 days). [ + or - ] nY


nY -2500 to +1581

nM -30000 to +30000

nW -30000 to +30000

nD -99999 to +99999
[ + or - ] nM
[ + or -] nW
[ + or - ] nD
(The plus [+] sign is optional.)
Specific Year – Age dates based on a specific four‑digit year in the desired format. nnnnY 1582 - 3999
Multiple/Rule – Age dates based on the number of times to apply a business rule. If you define the Age Function using the Multiple/Rule, you must also include the RULE parameter. nnnnnR 1 - 30000

Semantic Aging

Semantic Aging is based on a set of rules that you define to manage dates that occur on holidays, weekends, and so on. You can use Semantic Aging to adjust dates so that they occur on valid business days.

Calendar –
Name of the calendar that defines the special dates to which the rules apply. If you use CALENDAR, you must also specify a RULE.
CA=calendar-name
CALENDAR=calendar-name
Rule –
Name of the rule that defines the adjustment for special dates. If DEF is specified, the default rule specified in the process request is used.
RU=rule-name
RULE=rule-name
RU=DEF
RULE=DEF
Century Pivot –
Determines the century for two-digit years. Enter a value 00 to 99.
PI=nn
PIVOT=nn

Date Formats

The source date format and the destination date format must contain a single valid date format and must be less than or equal to the length of the destination column. The format string must be delimited by single quotation marks.

Source Date Format –
Applies the source column format string to age character and numeric columns.
SF='format-string'
SRCFMT='format-string'

If the source column is character or numeric, you must use SRCFMT or a Source Exit Routine (SRCEXIT) to describe the contents of the column. These parameters are mutually exclusive. See Exit Routines for Column Maps for details.

Destination Date Format –
Applies the destination column format string to age character and numeric columns.
DF='format-string'
DSTFMT='format-string'

If the destination column is character or numeric, you can specify DSTFMT or a Destination Exit Routine (DSTEXIT). If you do not specify a format for the destination, the date aging function uses SRCFMT by default. The destination column for an AGE function cannot be binary.

Use the following character strings to specify components of the date format:

Year Month Day Time Parts/Second
YYYY MONTH DDD HH FFFFFF
CCYY MMM DD MI FFFFF
YY MM D SS FFFF
  M     FFF
        FF
        F
Note: You can use the Calendar Utility to define a default separator and a default output year. These defaults apply when the source and destination formats require separators or a specific year.

Example 1

To age a date column by 2 years, 6 months, 40 weeks, and 15 days, and then apply a rule, format the Age Function as:

AGE(+2Y,+6M,+40W,+15D,RU=NEXTPAYDAY)

Example 2

To age only the year portion in a date column to the year 2020, and apply a rule, format the Age Function as:

AGE(2020Y,RU=NEXTWORKDAY)

Example 3

To age a date column using MULTIPLE/RULE to increment by five occurrences of a rule called NEXTSTRTQTR, using a calendar called PSAPRULE, format the Age Function as:

AGE(CA=PSAPRULE,RU=NEXTSTRTQTR,5R)

Example 4

To age data in a character or numeric column by the following parameters:

Format the Age Function as:

AGE(5Y,SC=ORDER_DATE,SF='YYDDD',PI=42)