MAXYEAR - Maximum Year for Date/Time Values

#### Search Results

Search

# MAXYEAR - Maximum Year for Date/Time Values

This Natural profile parameter sets the maximum value for the year part of date and time values that can be entered as constants or as terminal input.

Possible settings | `2699` | The maximum year that can be entered is `2699`; that is, the maximum date value that can be entered is `2699-12-31`.
`9999` | The maximum year that can be entered is `9999`; that is, the maximum date value that can be entered is `9999-12-31`.
Default setting | `2699` |
Dynamic specification | yes |
Specification within session | no |

Notes:

1. `MAXYEAR=9999` changes the maximum date value that can be entered from `2699-12-31` to `9999-12-31`.
2. Before setting the value for `MAXYEAR` to `9999`, you should carefully check your application for arithmetic operations or assignments of date or time values to fields that have data formats other than date or time, and perform the necessary changes. Otherwise, unexpected overflows leading to Natural errors at execution time may occur.

For example, you should check for

- redefinitions of date/time fields with P6/P12 fields

- assignments of date/time values to non-date/time fields such as `P6 := D`

- arithmetic operations with date/time values where the result is assigned to a non-date/time field, for example: `P6 := D + 7`

- input of date/time fields that is used in arithmetic operations with non-date/time fields later on, for example:

      INPUT D(D)
      P6 := D + 1

The use of the Natural Engineer is recommended to check your application.

The setting of `MAXYEAR` affects

- checking of date/time constants by the compiler, for example: `P6 := D'2699-12-31'`

- `INPUT` statements with input or modifiable date/time fields

- `MOVE` `EDITED` statements with source or target date/time fields

- `IS``(D)` option in logical condition criteria

- `MASK` option in logical condition criteria with four-digit year check `(YYYY)`

- `VAL` system function with date field as target operand

You should ensure that the `MAXYEAR` settings are the same for

- cataloging and executing a Natural application

- Natural RPC servers and Natural RPC clients

See also:

- Formats D - Date, and T - Time in the Programming Guide

- Date and Time Constants in the Programming Guide

- Session parameter `EM` in the Parameter Reference documentation