Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Language Reference


Semantics of windowed date fields

Windowed date fields undergo automatic expansion relative to the century window when they are used as operands in arithmetic expressions or arithmetic statements. However, the result of incrementing or decrementing a windowed date is still treated as a windowed date for further computation, comparison, and storing.

When used in the following situations, windowed date fields are treated as if they were converted to expanded date format:

The details of the conversion to expanded date format depend on whether the windowed date field is numeric or alphanumeric.

Given a century window starting year of 19nn, the year part (yy) of a numeric windowed date field is treated as if it were expanded as follows:

For signed numeric windowed date fields, this means that there can be two representations of some years. For instance, windowed year values 99 and -01 are both treated as 1999, since 1900 + 99 = 2000 + -01.

Alphanumeric windowed date fields are treated in a similar manner, but use a prefix of 19 or 20 instead of adding 1900 or 2000.

For example, when used as an operand of a relation condition, a windowed date field defined by:

01  DATE-FIELD  DATE FORMAT YYXXXX PICTURE 9(6)
                VALUE IS 450101.

is treated as if it were an expanded date field with a value of:

Date trigger values

When the DATEPROC(TRIG) compiler option is in effect, expansion of windowed date fields is sensitive to certain trigger or limit values in the windowed date field.

For alphanumeric windowed date fields, these special values are LOW-VALUE, HIGH-VALUE, and SPACE. For alphanumeric and numeric windowed date fields with at least one X in the DATE FORMAT clause (that is, windowed date fields other than just a windowed year), values of all zeros or all nines are also treated as triggers.

The all-zero value is intended to act as a date earlier than any valid date. The purpose of the all-nines value is to behave like a date later than any valid date.

When a windowed date field contains a trigger in this way, it is expanded as if the trigger value were copied to the century part of the expanded date result, rather than inferring 19 or 20 as the century value.

This special trigger expansion is done when a windowed date field is used either as an operand in a relation condition or as the sending field in an arithmetic or MOVE statement. Trigger expansion is not done when windowed date fields are used as operands in arithmetic expressions, but can be applied to the final windowed date result of an arithmetic expression.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)