3 ENVIRONMENT DIVISION Syntax

ENVIRONMENT DIVISION Syntax

  ENVIRONMENT DIVISION.
  ~~~~~~~~~~~ ~~~~~~~~
[ CONFIGURATION SECTION. ]
  ~~~~~~~~~~~~~ ~~~~~~~~
[ SOURCE-COMPUTER.         Compilation-Computer-Specification . ]
  ~~~~~~~~~~~~~~~
[ OBJECT-COMPUTER.         Execution-Computer-Specification . ]
  ~~~~~~~~~~~~~~~
[ SPECIAL-NAMES.           Program-Configuration-Specification . ]
  ~~~~~~~~~~~~~
[ REPOSITORY.              Function-Specification... . ]
  ~~~~~~~~~~
[ INPUT-OUTPUT SECTION. ]
  ~~~~~~~~~~~~ ~~~~~~~
[ FILE-CONTROL.            General-File-Description... . ]
  ~~~~~~~~~~~~
[ I-O-CONTROL.             File-Buffering Specification... . ]
  ~~~~~~~~~~~

CONFIGURATION SECTION Syntax

  CONFIGURATION SECTION.
  ~~~~~~~~~~~~~ ~~~~~~~
[ SOURCE-COMPUTER. Compilation-Computer-Specification . ]
  ~~~~~~~~~~~~~~~
[ OBJECT-COMPUTER. Execution-Computer-Specification . ]
  ~~~~~~~~~~~~~~~
[ SPECIAL-NAMES.   Program-Configuration-Specification . ]
  ~~~~~~~~~~~~~
[ REPOSITORY.      Function-Specification... . ]
  ~~~~~~~~~~

SOURCE-COMPUTER Syntax

SOURCE-COMPUTER. computer-name [ WITH DEBUGGING MODE ] .
~~~~~~~~~~~~~~~                       ~~~~~~~~~ ~~~~

OBJECT-COMPUTER Syntax

OBJECT-COMPUTER.  [ computer-name ]
~~~~~~~~~~~~~~~
[ MEMORY SIZE IS integer-1 WORDS|CHARACTERS ]
  ~~~~~~ ~~~~              ~~~~~ ~~~~~~~~~~
[ PROGRAM COLLATING SEQUENCE IS alphabet-name-1 ]
          ~~~~~~~~~
[ SEGMENT-LIMIT IS integer-2 ]
  ~~~~~~~~~~~~~
[ CHARACTER CLASSIFICATION IS { locale-name-1  } ]
            ~~~~~~~~~~~~~~    { LOCALE         }
                              { ~~~~~~         }
                              { USER-DEFAULT   }
                              { ~~~~~~~~~~~~   }
                              { SYSTEM-DEFAULT }
                                ~~~~~~~~~~~~~~
.

The MEMORY SIZE and SEGMENT-LIMITclauses are syntactically recognized but are otherwise non-functional.

SPECIAL-NAMES Syntax

SPECIAL-NAMES.
~~~~~~~~~~~~~
 [ CALL-CONVENTION integer-1 IS mnemonic-name-1 ]
   ~~~~~~~~~~~~~~~
 [ CONSOLE IS CRT ]
   ~~~~~~~    ~~~
 [ CRT STATUS IS identifier-1 ]
   ~~~ ~~~~~~
 [ CURRENCY SIGN IS literal-1 ]
   ~~~~~~~~ ~~~~
 [ CURSOR IS identifier-2 ]
   ~~~~~~
 [ DECIMAL-POINT IS COMMA ]
   ~~~~~~~~~~~~~    ~~~~~
 [ EVENT STATUS IS identifier-3 ]
   ~~~~~ ~~~~~~
 [ LOCALE locale-name-1 IS literal-2 ]...
   ~~~~~~
 [ NUMERIC SIGN IS TRAILING SEPARATE ]
   ~~~~~~~ ~~~~    ~~~~~~~~ ~~~~~~~~
 [ SCREEN CONTROL IS identifier-4 ]
   ~~~~~~ ~~~~~~~
 [ device-name-1 IS mnemonic-name-2 ]...

 [ feature-name-1 IS mnemonic-name-3 ]...

 [ Alphabet-Clause ]...

 [ Class-Definition-Clause ]...

 [ Switch-Definition-Clause ]...

 [ Symbolic-Characters-Clause ]...
 .

The EVENT STATUS and SCREEN CONTROLclauses are syntactically recognized but are otherwise non-functional.

REPOSITORY Syntax

REPOSITORY.
~~~~~~~~~~
   FUNCTION { function-prototype-name-1 [ AS literal-1 ] }...
   ~~~~~~~~ {                             ~~             }
            { intrinsic-function-name-1 [ AS literal-2 ] }
            {                             ~~             }
            { intrinsic-function-name-2 INTRINSIC        }
            { ALL INTRINSIC             ~~~~~~~~~        }
              ~~~ ~~~~~~~~~

SPECIAL-NAMES Alphabet-Clause Syntax

ALPHABET alphabet-name-1 IS { ASCII             }
~~~~~~~~                    { ~~~~~             }
                            { EBCDIC            }
                            { ~~~~~~            }
                            { NATIVE            }
                            { ~~~~~~            }
                            { STANDARD-1        }
                            { ~~~~~~~~~~        }
                            { STANDARD-2        }
                            { ~~~~~~~~~~        }
                            { Literal-Clause... }

SPECIAL-NAMES ALPHABET Literal-Clause Syntax

literal-1 [ { THRU|THROUGH literal-2 } ]
            { ~~~~ ~~~~~~~           }
            { {ALSO literal-3}...    }
               ~~~~

SPECIAL-NAMES Class-Definition-Clause Syntax

CLASS class-name-1 IS { literal-1 [ THRU|THROUGH literal-2 ] }...
~~~~~                               ~~~~ ~~~~~~~

SPECIAL-NAMES Switch-Definition-Clause Syntax

switch-name-1 [ IS mnemonic-name-1 ]

  [ ON STATUS IS condition-name-1 ]
    ~~
  [ OFF STATUS IS condition-name-2 ]
    ~~~

SPECIAL-NAMES-Symbolic-Characters-Clause Syntax

SYMBOLIC CHARACTERS
~~~~~~~~
  { symbolic-character-1... IS|ARE integer-1... }...

  [ IN alphabet-name-1 ]
    ~~

INPUT-OUTPUT SECTION Syntax

[ INPUT-OUTPUT SECTION. ]
  ~~~~~~~~~~~~ ~~~~~~~
[ FILE-CONTROL. ]
  ~~~~~~~~~~~~
    [ SELECT-Statement... ]

[ I-O-CONTROL. ]
  ~~~~~~~~~~~
    [ MULTIPLE-FILE-Statement ]

    [ SAME-RECORD-Statement ]

I-O-CONTROL MULTIPLE FILE Syntax

MULTIPLE FILE TAPE CONTAINS
~~~~~~~~
   { file-name-1 [ POSITION integer-1 ] }...
                   ~~~~~~~~
   .

The MULTIPLE FILE TAPE clause is obsolete and is therefore recognized but not functional.

I-O-CONTROL SAME AREA Syntax

SAME { SORT-MERGE } AREA FOR file-name-1... .
~~~~ { ~~~~~~~~~~ }
     { SORT       }
     { ~~~~       }
     { RECORD     }
       ~~~~~~

The SAME SORT-MERGE and SAME SORTclauses are syntactically recognized but are otherwise non-functional.

SELECT Statement Syntax

SELECT [ [ NOT ] OPTIONAL ] file-name-1
~~~~~~     ~~~   ~~~~~~~~
[ ASSIGN { TO    } [{ EXTERNAL }] [{ DISC|DISK      }] [{ identifier-1 }] ]
  ~~~~~~ { USING }  { ~~~~~~~~ }   { ~~~~ ~~~~      }   { word-1       }
                    { DYNAMIC  }   { DISPLAY        }   { literal-1    }
                      ~~~~~~~      { ~~~~~~~        }
                                   { KEYBOARD       }
                                   { ~~~~~~~~       }
                                   { LINE ADVANCING }
                                   { ~~~~ ~~~~~~~~~ }
                                   { PRINTER        }
                                   { ~~~~~~~        }
                                   { RANDOM         }
                                   { ~~~~~~         }
                                   { TAPE           }
                                     ~~~~
[ COLLATING SEQUENCE IS alphabet-name-1 ]
  ~~~~~~~~~
[ FILE|SORT ] STATUS IS identifier-2 [ identifier-3 ] ]
  ~~~~ ~~~~   ~~~~~~
[ LOCK MODE IS { MANUAL|AUTOMATIC                                } ]
  ~~~~         { ~~~~~~ ~~~~~~~~~                                }
               { EXCLUSIVE [ WITH { LOCK ON MULTIPLE RECORDS } ] }
                 ~~~~~~~~~        { ~~~~ ~~ ~~~~~~~~ ~~~~~~~ }
                                  { LOCK ON RECORD           }
                                  { ~~~~ ~~ ~~~~~~           }
                                  { ROLLBACK                 }
                                  { ~~~~~~~~                 }
[ ORGANIZATION Clause ]
  ~~~~~~~~~~~~
[ ORGANISATION Clause ]
  ~~~~~~~~~~~~
[ RECORD DELIMITER IS STANDARD-1 ]
  ~~~~~~ ~~~~~~~~~    ~~~~~~~~~~
[ RESERVE integer-1 AREAS ]
  ~~~~~~~
[ SHARING WITH { ALL OTHER } ]
  ~~~~~~~      { ~~~       }
               { NO OTHER  }
               { ~~        }
               { READ ONLY }
                 ~~~~ ~~~~

The COLLATING SEQUENCE, RECORD DELIMITER, RESERVE and ALL OTHER clauses are syntactically recognized but are otherwise non-functional.

ORGANIZATION SEQUENTIAL Clause Syntax

[ ORGANIZATION|ORGANISATION IS ] RECORD BINARY SEQUENTIAL
  ~~~~~~~~~~~~ ~~~~~~~~~~~~                    ~~~~~~~~~~
   [ ACCESS MODE IS SEQUENTIAL ]
     ~~~~~~         ~~~~~~~~~~

ORGANIZATION LINE SEQUENTIAL Clause Syntax

[ ORGANIZATION|ORGANISATION IS ] LINE SEQUENTIAL
  ~~~~~~~~~~~~ ~~~~~~~~~~~~      ~~~~ ~~~~~~~~~~
   [ ACCESS MODE IS SEQUENTIAL ]
     ~~~~~~         ~~~~~~~~~~
   [ PADDING CHARACTER IS literal-1 | identifier-1 ]
     ~~~~~~~

The PADDING CHARACTER clause is syntactically recognized but is otherwise non-functional.

ORGANIZATION RELATIVE Clause Syntax

[ ORGANIZATION|ORGANISATION IS ] RELATIVE
  ~~~~~~~~~~~~ ~~~~~~~~~~~~      ~~~~~~~~
   [ ACCESS MODE IS { SEQUENTIAL } ]
     ~~~~~~         { ~~~~~~~~~~ }
                    { DYNAMIC    }
                    { ~~~~~~~    }
                    { RANDOM     }
                      ~~~~~~
   [ RELATIVE KEY IS identifier-1 ]
     ~~~~~~~~

ORGANIZATION INDEXED Clause Syntax

[ ORGANIZATION|ORGANISATION IS ] INDEXED
  ~~~~~~~~~~~~ ~~~~~~~~~~~~      ~~~~~~~
   [ ACCESS MODE IS { SEQUENTIAL } ]
     ~~~~~~         { ~~~~~~~~~  }
                    { DYNAMIC    }
                    { ~~~~~~~    }
                    { RANDOM     }
                      ~~~~~~
   [ RECORD KEY IS { [ data-name-1       ]
     ~~~~~~
                   { [ record-key-name-1 ]
                     [ =|{SOURCE IS} data-name-2 ] ... ] }
                          ~~~~~~
   [ ALTERNATE RECORD KEY IS { [ data-name-3       ]
     ~~~~~~~~~ ~~~~~~
                             { [ record-key-name-2 ]
                               [ =|{SOURCE IS} data-name-4 ] ... ] }
                                    ~~~~~~
                             [ WITH DUPLICATES ] ]...
                                    ~~~~~~~~~~
                             [ SUPPRESS WHEN ALL literal     ]
                               ~~~~~~~~~~~~~~~~~
                             [ SUPPRESS WHEN SPACES | ZEROES ]
                               ~~~~~~~~~~~~~~~~~~~~   ~~~~~~