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