DATE FORMAT clause

The DATE FORMAT clause specifies that a data item is a windowed or expanded date field.

Windowed date fields
Contain a windowed (two-digit) year, specified by a DATE FORMAT clause that contains YY.
Expanded date fields
Contain an expanded (four-digit) year, specified by a DATE FORMAT clause that contains YYYY.

If the NODATEPROC compiler option is in effect, the DATE FORMAT clause is syntax checked but has no effect on the execution of the program. NODATEPROC disables date processing. The rules and restrictions described in this reference for the DATE FORMAT clause and date fields apply only if the DATEPROC compiler option is in effect.

The DATE FORMAT clause must not be specified for a data item described with USAGE NATIONAL.

Format

Read syntax diagramSkip visual syntax diagramDATE FORMATISdate-pattern

date-pattern is a character string, such as YYXXXX, that represents a windowed or expanded year optionally followed or preceded by one to four characters representing other parts of a date such as the month and day:

Date-pattern string Specifies that the data item contains
YY A windowed (two-digit) year
YYYY An expanded (four-digit) year
X A single character; for example, a digit representing a semester or quarter (14)
XX Two characters; for example, digits representing a month (0112)
XXX Three characters; for example, digits representing a day of the year (001366)
XXXX Four characters; for example, two digits representing a month (0112) and two digits representing a day of the month (0131)

For an introduction to date fields and related terms, see Millennium Language Extensions and date fields. For details on using date fields in applications, see Millennium language extensions (MLE) in the COBOL for Linux® on x86 Programming Guide.