4 DATA DIVISION Syntax

DATA DIVISION Syntax

  DATA DIVISION.
  ~~~~ ~~~~~~~~
[ FILE SECTION.
  ~~~~ ~~~~~~~
  { File/Sort-Description [ { FILE-SECTION-Data-Item } ]... }... ]
  {                         { 01-Level-Constant      }      }
  {                         { 78-Level-Constant      }      }
  { 01-Level-Constant                                       }
  { 78-Level-Constant                                       }
[ WORKING-STORAGE SECTION.
  ~~~~~~~~~~~~~~~ ~~~~~~~
  [ { WORKING-STORAGE-SECTION-Data-Item } ]... ]
    { 01-Level-Constant                 }
    { 78-Level-Constant                 }
[ LOCAL-STORAGE SECTION.
  ~~~~~~~~~~~~~ ~~~~~~~
  [ { LOCAL-STORAGE-SECTION-Data-Item } ]... ]
    { 01-Level-Constant               }
    { 78-Level-Constant               }
[ LINKAGE SECTION.
  ~~~~~~~ ~~~~~~~
  [ { LINKAGE-SECTION-Data-Item } ]... ]
    { 01-Level-Constant         }
    { 78-Level-Constant         }
[ REPORT SECTION.
  ~~~~~~ ~~~~~~~
  { Report-Description [ { Report-Group-Definition } ]... }... ]
  {                      { 01-Level-Constant       }      }
  {                      { 78-Level-Constant       }      }
  { 01-Level-Constant                                     }
  { 78-Level-Constant                                     }
[ SCREEN SECTION.
  ~~~~~~ ~~~~~~~
  [ { SCREEN-SECTION-Data-Item } ]... ]
    { 01-Level-Constant        }
    { 78-Level-Constant        }

File/Sort-Description Syntax

FD|SD file-name-1 [ IS EXTERNAL|GLOBAL ]
~~ ~~                  ~~~~~~~~ ~~~~~~
[ BLOCK CONTAINS [ integer-1 TO ] integer-2 CHARACTERS|RECORDS ]
  ~~~~~                      ~~             ~~~~~~~~~~ ~~~~~~~
[ CODE-SET IS alphabet-name-1 ]
  ~~~~~~~~
[ DATA { RECORD IS   } identifier-1... ]
  ~~~~ { ~~~~~~      }
       { RECORDS ARE }
         ~~~~~~~
[ LABEL { RECORD IS   } OMITTED|STANDARD ]
  ~~~~~ { ~~~~~~      } ~~~~~~~ ~~~~~~~~
        { RECORDS ARE }
          ~~~~~~~
[ LINAGE IS integer-3 | identifier-2 LINES
  ~~~~~~
    [ LINES AT BOTTOM integer-4 | identifier-3 ]
               ~~~~~~
    [ LINES AT TOP integer-5 | identifier-4 ]
               ~~~
    [ WITH FOOTING AT integer-6 | identifier-5 ] ]
           ~~~~~~~
[ RECORD { CONTAINS [ integer-7 TO ] integer-8 CHARACTERS   } ]
  ~~~~~~ {                      ~~                          }
         { IS VARYING IN SIZE                               }
         {    ~~~~~~~                                       }
         {     [ FROM [ integer-7 TO ] integer-8 CHARACTERS }
         {                        ~~                        }
         {         DEPENDING ON identifier-6 ]              }
                   ~~~~~~~~~
[ RECORDING MODE IS recording-mode ]
  ~~~~~~~~~
[ { REPORT IS   } report-name-1... ]
  { ~~~~~~      }
  { REPORTS ARE }
    ~~~~~~~
[ VALUE OF implementor-name-1 IS literal-1 | identifier-7 ] .
  ~~~~~ ~~

The BLOCK CONTAINS, DATA RECORD, LABEL RECORD, RECORDING MODE and VALUE OFclauses are syntactically recognized but are obsolete and non-functional. These clauses should not be coded in new programs.

FILE-SECTION-Data-Item Syntax

level-number [ identifier-1 | FILLER ] [ IS GLOBAL|EXTERNAL ]
                              ~~~~~~        ~~~~~~ ~~~~~~~~
[ BLANK WHEN ZERO ]
  ~~~~~      ~~~~
[ JUSTIFIED RIGHT ]
  ~~~~
[ OCCURS [ integer-1 TO ] integer-2 TIMES
  ~~~~~~             ~~   UNBOUNDED
                          ~~~~~~~~~
       [ DEPENDING ON identifier-2 ]
         ~~~~~~~~~
       [ STEP identifier-6 ]
       [ ASCENDING|DESCENDING KEY IS identifier-3 ]
         ~~~~~~~~~ ~~~~~~~~~~
       [ INDEXED BY identifier-4 ] ]
         ~~~~~~~
[ PICTURE IS picture-string ]
  ~~~
[ REDEFINES identifier-5 ]
  ~~~~~~~~~
[ SIGN IS LEADING|TRAILING [ SEPARATE [CHARACTER] ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ SYNCHRONIZED|SYNCHRONISED [ LEFT|RIGHT ] ]
  ~~~~        ~~~~           ~~~~ ~~~~~
[ USAGE IS data-item-usage ] . [ FILE-SECTION-Data-Item ]...
  ~~~~~

The LEFT and RIGHT (SYNCHRONIZED) clauses are syntactically recognized but are otherwise non-functional.

WORKING-STORAGE-SECTION-Data-Item Syntax

level-number [ identifier-1 | FILLER ] [ IS GLOBAL | EXTERNAL ]
                              ~~~~~~        ~~~~~~   ~~~~~~~~
[ BASED ]
  ~~~~~
[ BLANK WHEN ZERO ]
  ~~~~~      ~~~~
[ JUSTIFIED RIGHT ]
  ~~~~
[ OCCURS [ integer-1 TO ] integer-2 TIMES
  ~~~~~~             ~~   UNBOUNDED
                          ~~~~~~~~~
      [ DEPENDING ON identifier-2 ]
        ~~~~~~~~~
      [ ASCENDING|DESCENDING KEY IS identifier-3 ]
        ~~~~~~~~~ ~~~~~~~~~~
      [ INDEXED BY identifier-4 ] ]
        ~~~~~~~
[ PICTURE IS picture-string ]
  ~~~
[ REDEFINES identifier-5 ]
  ~~~~~~~~~
[ SIGN IS LEADING|TRAILING [ SEPARATE CHARACTER ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ SYNCHRONIZED|SYNCHRONISED [ LEFT|RIGHT ] ]
  ~~~~        ~~~~           ~~~~ ~~~~~
[ USAGE IS data-item-usage ]
  ~~~~~
[ VALUE IS [ ALL ] literal-1 ] . [ WORKING-STORAGE-SECTION-Data-Item ]...
  ~~~~~      ~~~

The LEFT and RIGHT (SYNCHRONIZED) clauses are syntactically recognized but are otherwise non-functional.

LOCAL-STORAGE-SECTION-Data-Item Syntax

level-number [ identifier-1 | FILLER ] [ IS GLOBAL|EXTERNAL ]
                              ~~~~~~        ~~~~~~ ~~~~~~~~
[ BASED ]
  ~~~~~
[ BLANK WHEN ZERO ]
  ~~~~~      ~~~~
[ JUSTIFIED RIGHT ]
  ~~~~
[ OCCURS [ integer-1 TO ] integer-2 TIMES
  ~~~~~~             ~~   UNBOUNDED
                          ~~~~~~~~~
      [ DEPENDING ON identifier-2 ]
        ~~~~~~~~~
      [ ASCENDING|DESCENDING KEY IS identifier-3 ]
        ~~~~~~~~~ ~~~~~~~~~~
      [ INDEXED BY identifier-4 ] ]
        ~~~~~~~
[ PICTURE IS picture-string ]
  ~~~
[ REDEFINES identifier-5 ]
  ~~~~~~~~~
[ SIGN IS LEADING|TRAILING [ SEPARATE CHARACTER ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ SYNCHRONIZED|SYNCHRONISED [ LEFT|RIGHT ] ]
  ~~~~        ~~~~           ~~~~ ~~~~~
[ USAGE IS data-item-usage ]
  ~~~~~
[ VALUE IS [ ALL ] literal-1 ] . [ LOCAL-STORAGE-SECTION-Data-Item ]...
  ~~~~~      ~~~

The LEFT and RIGHT (SYNCHRONIZED) clauses are syntactically recognized but are otherwise non-functional.

LINKAGE-SECTION-Data-Item Syntax

level-number [ identifier-1 | FILLER ] [ IS GLOBAL|EXTERNAL ]
                              ~~~~~~        ~~~~~~ ~~~~~~~~
[ ANY LENGTH ]
  ~~~ ~~~~~~
[ ANY NUMERIC ]
  ~~~ ~~~~~~~
[ BASED ]
  ~~~~~
[ BLANK WHEN ZERO ]
  ~~~~~      ~~~~
[ JUSTIFIED RIGHT ]
  ~~~~
[ OCCURS [ integer-1 TO ] integer-2 TIMES
  ~~~~~~             ~~
      [ DEPENDING ON identifier-3 ]
        ~~~~~~~~~
      [ ASCENDING|DESCENDING KEY IS identifier-4 ]
        ~~~~~~~~~ ~~~~~~~~~~
      [ INDEXED BY identifier-5 ] ]
        ~~~~~~~
[ PICTURE IS picture-string ]
  ~~~
[ REDEFINES identifier-6 ]
  ~~~~~~~~~
[ SIGN IS LEADING|TRAILING [ SEPARATE CHARACTER ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ SYNCHRONIZED|SYNCHRONISED [ LEFT|RIGHT ] ]
  ~~~~        ~~~~           ~~~~ ~~~~~
[ USAGE IS data-item-usage ] . [ LINKAGE-SECTION-Data-Item ]...
  ~~~~~

The LEFT and RIGHT (SYNCHRONIZED) clauses are syntactically recognized but are otherwise non-functional.

Report-Description (RD) Syntax

RD report-name [ IS GLOBAL ]
~~                  ~~~~~~
[ CODE IS literal-1 | identifier-1 ]
  ~~~~
[ { CONTROL IS   } { FINAL        }... ]
  { ~~~~~~~      } { ~~~~~        }
  { CONTROLS ARE } { identifier-2 }
    ~~~~~~~~
[ PAGE [ { LIMIT IS   } ] [ { literal-2    } LINES ]
  ~~~~   { ~~~~~      }     { identifier-3 } ~~~~
         { LIMITS ARE }
           ~~~~~~
      [ literal-3 | identifier-4 COLUMNS|COLS ]
                                 ~~~~~~~ ~~~~
      [ HEADING IS literal-4 | identifier-5 ]
        ~~~~~~~
      [ FIRST DE|DETAIL IS literal-5 | identifier-6 ]
        ~~~~~ ~~ ~~~~~~
      [ LAST CH|{CONTROL HEADING} IS literal-6 | identifier-7 ]
        ~~~~ ~~  ~~~~~~~ ~~~~~~~
      [ LAST DE|DETAIL IS literal-7 | identifier-8 ]
        ~~~~ ~~ ~~~~~~
      [ FOOTING IS literal-8 | identifier-9 ] ] .
        ~~~~~~~

Report-Group-Definition Syntax

01 [ identifier-1 ]

[ LINE NUMBER IS { integer-1 [ [ ON NEXT PAGE ] } ]
  ~~~~           {                  ~~~~ ~~~~   }
                 { +|PLUS integer-1             }
                 {   ~~~~                       }
                 { ON NEXT PAGE                 }
                      ~~~~ ~~~~
[ NEXT GROUP IS { [ +|PLUS ] integer-2  } ]
  ~~~~ ~~~~~    {     ~~~~              }
                { NEXT|{NEXT PAGE}|PAGE }
                  ~~~~  ~~~~ ~~~~  ~~~~
[ TYPE IS { RH|{REPORT HEADING}                      } ]
  ~~~~    { ~~  ~~~~~~ ~~~~~~~                       }
          { PH|{PAGE HEADING}                        }
          { ~~  ~~~~ ~~~~~~~                         }
          { CH|{CONTROL HEADING} FINAL|identifier-2  }
          { ~~  ~~~~~~~ ~~~~~~~  ~~~~~               }
          { DE|DETAIL                                }
          { ~~ ~~~~~~                                }
          { CF|{CONTROL FOOTING} FINAL|identifier-2  }
          { ~~  ~~~~~~~ ~~~~~~~  ~~~~~               }
          { PF|{PAGE FOOTING}                        }
          {  ~~ ~~~~ ~~~~~~~                         }
          { RF|{REPORT FOOTING}                      }
            ~~  ~~~~~~ ~~~~~~~
. [ REPORT-SECTION-Data-Item ]...

REPORT-SECTION-Data-Item Syntax

level-number [ identifier-1 ]

[ BLANK WHEN ZERO ]
  ~~~~~      ~~~~
[ COLUMN [ { NUMBER IS   } ] [ +|PLUS ] integer-1 ]
  ~~~      { ~~~~~~      }       ~~~~
           { NUMBERS ARE }
             ~~~~~~~
[ GROUP INDICATE ]
  ~~~~~ ~~~~~~~~
[ JUSTIFIED RIGHT ]
  ~~~~
[ LINE NUMBER IS { integer-2 [ [ ON NEXT PAGE ] } ]
  ~~~~           { +|PLUS integer-2 ~~~~ ~~~~   }
                 {   ~~~~                       }
                 { ON NEXT PAGE                 }
                      ~~~~ ~~~~
[ OCCURS [ integer-3 TO ] integer-4 TIMES
  ~~~~~~             ~~   UNBOUNDED
                          ~~~~~~~~~
    [ DEPENDING ON identifier-2 ]
      ~~~~~~~~~
    [ STEP integer-5 ]
      ~~~~
    [ VARYING identifier-3 FROM { identifier-4 } BY { identifier-5 } ]
      ~~~~~~~              ~~~~ { integer-6    } ~~ { integer-7    }
[ PICTURE IS picture-string ]
  ~~~
[ PRESENT WHEN condition-name ]
  ~~~~~~~ ~~~~
[ SIGN IS LEADING|TRAILING [ SEPARATE CHARACTER ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ { SOURCE IS literal-1|identifier-6 [ ROUNDED ]                   } ]
  { ~~~~~~                             ~~~~~~~                     }
  { SUM OF { identifier-7 }... [ { RESET ON FINAL|identifier-8 } ] }
  { ~~~    { literal-2    }      { ~~~~~    ~~~~~              }   }
  { VALUE IS [ ALL ] literal-3   { UPON identifier-9           }   }
    ~~~~~      ~~~                 ~~~~
. [ REPORT-SECTION-Data-Item ]...

SCREEN-SECTION-Data-Item Syntax

level-number [ identifier-1 | FILLER ]
                              ~~~~~~

[ AUTO | AUTO-SKIP | AUTOTERMINATE ] [ BELL | BEEP ]
  ~~~~   ~~~~~~~~~   ~~~~~~~~~~~~~     ~~~~   ~~~~
[ BACKGROUND-COLOR|BACKGROUND-COLOUR IS integer-1 | identifier-2 ]
  ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
[ BEFORE TIME | BASED ]
  ~~~~~~ ~~~~   ~~~~~
[ BLANK LINE|SCREEN ] [ ERASE EOL|EOS ]
  ~~~~~ ~~~~ ~~~~~~     ~~~~~ ~~~ ~~~
[ BLANK WHEN ZERO ] [ JUSTIFIED RIGHT ]
  ~~~~~      ~~~~     ~~~~
[ BLINK ] [ HIGHLIGHT | LOWLIGHT ] [ REVERSE-VIDEO ]
  ~~~~~     ~~~~~~~~~   ~~~~~~~~     ~~~~~~~~~~~~~
[ COLUMN NUMBER IS [ +|PLUS ] integer-2 | identifier-3 ]
  ~~~                  ~~~~
[ CONSTANT | EMPTY CHECK ]
  ~~~~~~~    ~~~~~ ~~~~~
[ FOREGROUND-COLOR|FOREGROUND-COLOUR IS integer-3 | identifier-4 ]
  ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
[ { FROM literal-1 | identifier-5 } ]
  { ~~~~                          }
  { TO identifier-5               }
  { ~~                            }
  { USING identifier-5            }
  { ~~~~~                         }
  { VALUE IS [ ALL ] literal-1    }
    ~~~~~      ~~~
[ FULL | LENGTH-CHECK ] [ REQUIRED | EMPTY-CHECK ] [ SECURE | NO-ECHO ]
  ~~~~   ~~~~~~~~~~~~     ~~~~~~~~   ~~~~~~~~~~~     ~~~~~~   ~~~~~~~
[ LEFTLINE ] [ OVERLINE ] [ UNDERLINE ]
  ~~~~~~~~     ~~~~~~~~     ~~~~~~~~~
[ LINE NUMBER IS [ +|PLUS ] integer-4 | identifier-6 ]
  ~~~~               ~~~~
[ NO-ECHO | NO UPDATE ]
  ~~~~~~~   ~~ ~~~~~
[ OCCURS integer-5 TIMES ]
  ~~~~~~
[ PICTURE IS picture-string ]
  ~~~
[ PROMPT [ CHARACTER IS literal-2 | identifier-7 ]
  ~~~~~~   ~~~~~~~~~
[ SCROLL DOWN | SCROLL UP | SIZE | TIME OUT ]
  ~~~~~~ ~~~~   ~~~~~~ ~~   ~~~~   ~~~~ ~~~


[ SIGN IS LEADING|TRAILING [ SEPARATE CHARACTER ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ UPDATE ]
  ~~~~~~
. [ SCREEN-SECTION-Data-Item ]...

01-Level-Constant Syntax

01 constant-name-1 CONSTANT [ IS GLOBAL ]
                   ~~~~~~~~      ~~~~~~
  { AS { literal-1                           } }
  {    { arithmetic-expression-1             } }
  {    { { BYTE-LENGTH } OF { identifier-1 } } }
  {    { { ~~~~~~~~~~~ }    { usage-name   } } }
  {    { { LENGTH      }                     } }
  {        ~~~~~~                              }
  { FROM CDF-variable-name-1                   }
    ~~~~

66-Level-Data-Item Syntax

66 identifier-1 RENAMES identifier-2 [ THRU|THROUGH identifier-3 ] .
                ~~~~~~~                ~~~~ ~~~~~~~

77-Level-Data-Item Syntax

77 identifier-1 [ IS GLOBAL|EXTERNAL ]
                     ~~~~~~ ~~~~~~~~
[ BASED ]
  ~~~~~
[ BLANK WHEN ZERO ]
  ~~~~~      ~~~~
[ JUSTIFIED RIGHT ]
  ~~~~
[ PICTURE IS picture-string ]
  ~~~
[ REDEFINES identifier-5 ]
  ~~~~~~~~~
[ SIGN IS LEADING|TRAILING [ SEPARATE CHARACTER ] ]
  ~~~~    ~~~~~~~ ~~~~~~~~   ~~~~~~~~
[ SYNCHRONIZED|SYNCHRONISED [ LEFT|RIGHT ] ]
  ~~~~        ~~~~           ~~~~ ~~~~~
[ USAGE IS data-item-usage ]
  ~~~~~
[ VALUE IS [ ALL ] literal-1 ] .
  ~~~~~      ~~~

The LEFT and RIGHT (SYNCHRONIZED) clauses are syntactically recognized but are otherwise non-functional.

78-Level-Constant Syntax

78 constant-name-1 VALUE IS ( literal-1                           )
                   ~~~~~
                            { arithmetic-expression-1             }

88-Level-Data-Item Syntax

88 condition-name-1 { VALUE IS   } {literal-1 [ THRU|THROUGH literal-2 ]}...
                    { ~~~~~      }              ~~~~ ~~~~~~~
                    { VALUES ARE }
                      ~~~~~~

  [ WHEN SET TO FALSE IS literal-3 ] .
                ~~~~~