Welcome to myCobol.ovh Monday, 29 September 2025, 06:14

compatible date field
Category Syntax
Subject Cobol
The meaning of the term compatible, when applied to date fields, depends on the COBOL division in which the usage occurs:
    DATA DIVISION: Two date fields are compatible if they have identical USAGE and meet at least one of the following conditions:
  • They have the same date format.
  • Both are windowed date fields, where one consists only of a windowed year, DATE FORMAT YY.
  • Both are expanded date fields, where one consists only of an expanded year, DATE FORMAT YYYY.
  • One has DATE FORMAT YYXXXX, and the other has YYXX.
  • One has DATE FORMAT YYYYXXXX, and the other has YYYYXX.
  • A windowed date field can be subordinate to a data item that is an expanded date group. The two date fields are compatible if the subordinate date field has USAGE DISPLAY, starts two bytes after the start of the group expanded date field, and the two fields meet at least one of the following conditions:
  • The subordinate date field has a DATE FORMAT pattern with the same number of Xs as the DATE FORMAT pattern of the group date field.
  • The subordinate date field has DATE FORMAT YY.
  • The group date field has DATE FORMAT YYYYXXXX and the subordinate date field has DATE FORMAT YYXX.
    PROCEDURE DIVISION: Two date fields are compatible if they have the same date format except for the year part, which can be windowed or expanded. For example, a windowed date field with DATE FORMAT YYXXX is compatible with:
  • Another windowed date field with DATE FORMAT YYXXX
  • An expanded date field with DATE FORMAT YYYYXXX
Submitted by remy
Created on Sunday, 07 November 2021, 02:48

Back to Glossary