DATE FORMAT Clause

The COBOL DATE FORMAT clause specifies that a data item is a date field. Some formats do not specify whether day or month comes first. In such cases this is determined by the Day First field of the Copybook connection.

In JSON date fields are represented by strings in YYYY-MM-DD format.

Not all COBOL formats contain full year, month, and day. For example, YY only contains a two-digit year. In such cases, when the date is parsed, the missing date parts are defaulted to the lowest values: day 1, year 0001, and month of January.

When one of the incomplete formats is rendered, the date parts in JSON that are absent in COBOL DATE FORMAT are ignored.

Two-Digit Year

Two-digit year format is processed in accordance with the Base year for two-digit year setting in the Copybook connection. This value acts as the base-year in YEARWINDOW(base-year) option of the COBOL compiler.

You must specify it with one of the following values:

  • An integer number between 1900 and 1999: This specifies the starting year of a fixed window. For example, YEARWINDOW(1930) indicates a century window of 1930-2029. Years preceding 30 are considered as years of the 21st century and years starting at 30 belongs to the twentieth century.
  • A negative integer from -1 through -99: This indicates a sliding window. The first year of the window is calculated by adding the negative integer to the current year. For example, YEARWINDOW(-80) indicates that the first year of the century window is 80 years before the year in which the program is run.

DATE FORMAT on a Group Level

The connector does not support DATE FORMAT at group level. It is ignored in such cases.