Date fields can be alphanumeric category, zoned decimal, or internal decimal; the existing rules for the validity and comparison type (numeric or alphanumeric) apply. For example, an alphanumeric date field cannot be compared with an internal decimal date field. In addition to these rules, two date fields can be compared only if they are compatible; they must have the same date format except for the year part, which can be windowed or expanded.
For year-last date fields, the only comparisons that are supported are IS EQUAL TO and IS NOT EQUAL TO between two year-last date fields with identical date formats, or between a year-last date field and a nondate.
Table 1 shows supported comparisons for nonyear-last date fields. This table uses the following terms to describe how the comparisons are performed:
The comparison is then performed according to normal COBOL rules. Alphanumeric comparisons are not changed to numeric comparisons by the prefixing of the century value.
|
Windowed |
Expanded |
|
|---|---|---|---|
Nondate |
Nonwindowed | Windowed1 | Nonwindowed |
Windowed date field |
Windowed1 | Windowed | Windowed |
Expanded date field |
Nonwindowed | Windowed | Nonwindowed |
|
|||
Relation conditions can contain arithmetic expressions. For information about the treatment of date fields in arithmetic expressions, see Arithmetic with date fields.