The following sections describe restrictions on using date fields in these contexts:
For restrictions on using date fields in other contexts, see:
The following phrases are the only phrases of the USAGE clause that can be combined with the DATE FORMAT clause:
1USAGE COMPUTATIONAL cannot be combined with the DATE FORMAT clause if the TRUNC(BIN) compiler option is in effect.
The PICTURE character-string must specify the same number of characters or digits as the DATE FORMAT clause. For alphanumeric date fields, the only PICTURE character-string symbols allowed are A, 9, and X, with at least one X. For numeric date fields, the only PICTURE character-string symbols allowed are 9 and S.
The following clauses are not allowed for a data item defined with DATE FORMAT:
The EXTERNAL clause is not allowed for a windowed date field or a group item that contains a windowed date field subordinate item.
Some restrictions apply when combining the following clauses with DATE FORMAT:
If a group item is defined with a DATE FORMAT clause, then the following restrictions apply:
For example, the following defines a valid group item:
01 YYMMDD DATE FORMAT YYXXXX.
02 YYMM DATE FORMAT YYXX.
03 YY DATE FORMAT YY PICTURE 99.
03 PICTURE 99.
02 DD PICTURE 99.
If date fields are used in the following language elements, they are treated as nondates. That is, the DATE FORMAT is ignored, and the content of the date data item is used without undergoing automatic expansion.
Windowed date fields cannot be used as:
Windowed date fields can be used as ascending or descending keys in MERGE and SORT statements, with some restrictions. For details, see MERGE statement and SORT statement.
Neither windowed date fields nor expanded date fields can be used:
(Date fields cannot be used as operands in division or multiplication.)