5 PROCEDURE DIVISION Syntax

PROCEDURE DIVISION Syntax

  PROCEDURE DIVISION [ { USING Subprogram-Argument...     } ]
  ~~~~~~~~~ ~~~~~~~~   { ~~~~~                            }
                       { CHAINING Main-Program-Argument...}
                         ~~~~~~~~
                     [ RETURNING identifier-1 ] .
[ DECLARATIVES. ]      ~~~~~~~~~
  ~~~~~~~~~~~~
[ Event-Handler-Routine... . ]

[ END DECLARATIVES. ]
  ~~~ ~~~~~~~~~~~~
  General-Program-Logic

[ Nested-Subprogram... ]

[ END PROGRAM|FUNCTION name-1 ]
  ~~~ ~~~~~~~ ~~~~~~~~

PROCEDURE DIVISION Subprogram-Argument Syntax

[ BY { REFERENCE [ OPTIONAL ]                       } ] identifier-1
     { ~~~~~~~~~   ~~~~~~~~                         }
     { VALUE [ [ UNSIGNED ] SIZE IS { AUTO      } ] }
       ~~~~~     ~~~~~~~~   ~~~~    { ~~~~      }
                                    { DEFAULT   }
                                    { ~~~~~~~   }
                                    { integer-1 }

PROCEDURE DIVISION Main-Program-Argument Syntax

[ BY REFERENCE ] [ OPTIONAL ] identifier-1
     ~~~~~~~~~     ~~~~~~~~

PROCEDURE DIVISION RETURNING Syntax

RETURNING identifier-1
~~~~~~~~~

DECLARATIVES Syntax

section-name-1 SECTION.

 USE { [ GLOBAL ] AFTER STANDARD { EXCEPTION } PROCEDURE ON { INPUT       } }
 ~~~ {   ~~~~~~                  { ~~~~~~~~~ }              { ~~~~~       } }
     {                           { ERROR     }              { OUTPUT      } }
     {                             ~~~~~                    { ~~~~~~      } }
     {                                                      { I-O         } }
     { FOR DEBUGGING ON { procedure-name-1           }      { ~~~         } }
     {     ~~~~~~~~~    { ALL PROCEDURES             }      { EXTEND      } }
     {                  { ~~~ ~~~~~~~~~~             }      { ~~~~~~      } }
     {                  { REFERENCES OF identifier-1 }      { file-name-1 } }
     {                                                                      }
     { [ GLOBAL ] BEFORE REPORTING identifier-2                             }
     {   ~~~~~~   ~~~~~~ ~~~~~~~~~                                          }
     {                                                                      }
     { AFTER EC|{EXCEPTION CONDITION}                                       }
             ~~  ~~~~~~~~~ ~~~~~~~~~

The AFTER EXCEPTION CONDITION and AFTER EC clauses are syntactically recognized but are otherwise non-functional.

LENGTH OF Syntax

LENGTH OF numeric-literal-1 | identifier-1
~~~~~~

Reference Modifier (Format 1) Syntax

identifier-1 [ OF|IN identifier-2 ] [ (subscript...) ] (start:[ length ])
               ~~ ~~

Reference Modifier (Format 2) Syntax

intrinsic-function-reference (start:[ length ])

Arithmetic-Expression Syntax

Unary-Expression-1 { **|^ } Unary-Expression-2
                   {  *|/ }
                   {  +|- }

Unary-Expression Syntax

{ [ +|- ] { ( Arithmetic-Expression-1 )          } }
{         { [ LENGTH OF ] { identifier-1       } } }
{         {   ~~~~~~ ~~   { literal-1          } } }
{         {               { Function-Reference } } }
{ Arithmetic-Expression-2                          }

Class-Condition Syntax

identifier-1 IS [ NOT ] { NUMERIC          }
                  ~~~   { ~~~~~~~          }
                        { ALPHABETIC       }
                        { ~~~~~~~~~~       }
                        { ALPHABETIC-LOWER }
                        { ~~~~~~~~~~~~~~~~ }
                        { ALPHABETIC-UPPER }
                        { ~~~~~~~~~~~~~~~~ }
                        { OMITTED          }
                        { ~~~~~~~          }
                        { class-name-1     }

Sign-Condition Syntax

identifier-1 IS [ NOT ] { POSITIVE }
                  ~~~   { ~~~~~~~~ }
                        { NEGATIVE }
                        { ~~~~~~~~ }
                        { ZERO     }
                          ~~~~

Relation-Condition Syntax

{ identifier-1            } IS [ NOT ] RelOp { identifier-2            }
{ literal-1               }      ~~~         { literal-2               }
{ arithmetic-expression-1 }                  { arithmetic-expression-2 }
{ index-name-1            }                  { index-name-2            }

RelOp Syntax

{ EQUAL TO                 }
{ ~~~~~                    }
{ EQUALS                   }
{ ~~~~~~                   }
{ GREATER THAN             }
{ ~~~~~~~                  }
{ GREATER THAN OR EQUAL TO }
{ ~~~~~~~      ~~ ~~~~~    }
{ LESS THAN                }
{ ~~~~                     }
{ LESS THAN OR EQUAL TO    }
{ ~~~~      ~~ ~~~~~       }
{ =                        }
{ >                        }
{ >=                       }
{ <                        }
{ <=                       }

Combined Condition Syntax

[ ( ] Condition-1 [ ) ] { AND } [ ( ] Condition-2 [ ) ]
                        { ~~~ }
                        { OR  }
                        { ~~  }

Negated Condition Syntax

NOT Condition-1
~~~

ACCEPT FROM CONSOLE Syntax

  ACCEPT { identifier-1 }   [ FROM mnemonic-name-1 ]
  ~~~~~~                      ~~~~
         { OMITTED      }
           ~~~~~~~

[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT FROM COMMAND-LINE Syntax

  ACCEPT identifier-1
  ~~~~~~
         FROM { COMMAND-LINE                                }
         ~~~~ { ~~~~~~~~~~~~                                }
              { ARGUMENT-NUMBER                             }
              { ~~~~~~~~~~~~~~~                             }
              { ARGUMENT-VALUE                              }
              { ~~~~~~~~~~~~~~                              }
              [ ON EXCEPTION imperative-statement-1 ]
                   ~~~~~~~~~
              [ NOT ON EXCEPTION imperative-statement-2 ]
                ~~~    ~~~~~~~~~
[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT FROM ENVIRONMENT Syntax

  ACCEPT identifier-1
  ~~~~~~
         FROM { ENVIRONMENT-VALUE            }
         ~~~~ { ~~~~~~~~~~~~~~~~~            }
              { ENVIRONMENT { literal-1    } }
              { ~~~~~~~~~~~ { identifier-1 } }
       [ ON EXCEPTION imperative-statement-1 ]
            ~~~~~~~~~
       [ NOT ON EXCEPTION imperative-statement-2 ]
         ~~~    ~~~~~~~~~
[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT Data-Item Syntax

  ACCEPT { identifier-1 }
  ~~~~~~
         { OMITTED      }
           ~~~~~~~
                          [{ FROM EXCEPTION-STATUS }]
                             ~~~~ ~~~~~~~~~~~~~~~~
                          [{ FROM CRT ] [ MODE IS BLOCK ]}
                             ~~~~ ~~~     ~~~~    ~~~~~

         [ AT { | LINE NUMBER { integer-1    }                | } ]
           ~~ { | ~~~~        { identifier-2 }                | }
              { | COLUMN|COL|POSITION|POS NUMBER { integer-2    }
              { | ~~~~~~ ~~~ ~~~~~~~~ ~~~        { identifier-3 }
              {                                                 }
              { { integer-3    }                                }
              { { identifier-4 }                                }

         [ WITH [ Attribute-Specification ]...
           ~~~~
                [ LOWER|UPPER ]
                  ~~~~~ ~~~~~
                [ SCROLL { UP   } [ { integer-4    } LINE|LINES ] ]
                  ~~~~~~ { ~~   }   { identifier-5 }
                         { DOWN }
                           ~~~~
                [ TIMEOUT|TIME-OUT AFTER { integer-5    } ]
                  ~~~~~~~ ~~~~~~~~       { identifier-6 }
                [ CONVERSION ]
                  ~~~~~~~~~~
                [ UPDATE ]
                  ~~~~~~
                [ SIZE  { integer-6    } ]
                  ~~~~  { identifier-7 }
                [ CONTROL        { literal-8    } ]
                  ~~~~~~~        { identifier-8 }
                [ { COLOUR } IS  { integer-9    } ]
                  { COLOR  }     { identifier-9 }
                    ~~~~~~

         [ ON EXCEPTION imperative-statement-1 ]
              ~~~~~~~~~
         [ NOT ON EXCEPTION imperative-statement-2 ]
           ~~~    ~~~~~~~~~
[ END-ACCEPT ]
  ~~~~~~~~~~

The FROM CRT, MODE IS BLOCK and CONVERSIONclauses are syntactically recognized but are otherwise non-functional.

ACCEPT FROM DATE/TIME Syntax

  ACCEPT identifier-1 FROM { DATE [ YYYYMMDD ] }
  ~~~~~~              ~~~~ { ~~~~   ~~~~~~~~   }
                           { DAY [ YYYYDDD ]   }
                           { ~~~   ~~~~~~~     }
                           { DAY-OF-WEEK       }
                           { ~~~~~~~~~~~       }
                           { TIME              }
                           { ~~~~              }
                           { MICROSECOND-TIME  }
                           { ~~~~~~~~~~~~~~~~  }
[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT FROM Screen-Info Syntax

  ACCEPT identifier-1
  ~~~~~~
         FROM { LINES|LINE-NUMBER }
         ~~~~ { ~~~~~ ~~~~~~~~~~~ }
              { COLS|COLUMNS      }
              { ~~~~ ~~~~~~~      }
              { ESCAPE KEY        }
                ~~~~~~ ~~~
[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT FROM Runtime-Info Syntax

  ACCEPT identifier-1
  ~~~~~~
         FROM { EXCEPTION STATUS }
         ~~~~ { ~~~~~~~~~ ~~~~~~ }
              { USER NAME        }
                ~~~~ ~~~~
[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT OMITTED Syntax

  ACCEPT OMITTED
  ~~~~~~

  1.  For console : See 6.17.1.1 (ACCEPT FROM CONSOLE Syntax)

  2.  For Screen  : See 6.17.1.4 (ACCEPT screen-data-item Syntax)

[ END-ACCEPT ]
  ~~~~~~~~~~

ACCEPT FROM EXCEPTION STATUS Syntax

  ACCEPT exception-status-pic-9-4   FROM EXCEPTION STATUS
  ~~~~~~                            ~~~~ ~~~~~~~~~ ~~~~~~

[ END-ACCEPT ]
  ~~~~~~~~~~

ADD TO Syntax

  ADD { literal-1    }...
  ~~~ { identifier-1 }

      TO { identifier-2
      ~~
         [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
           ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                             { NEAREST-AWAY-FROM-ZERO }
                             { ~~~~~~~~~~~~~~~~~~~~~~ }
                             { NEAREST-EVEN           }
                             { ~~~~~~~~~~~~           }
                             { NEAREST-TOWARD-ZERO    }
                             { ~~~~~~~~~~~~~~~~~~~    }
                             { PROHIBITED             }
                             { ~~~~~~~~~~             }
                             { TOWARD-GREATER         }
                             { ~~~~~~~~~~~~~~         }
                             { TOWARD-LESSER          }
                             { ~~~~~~~~~~~~~          }
                             { TRUNCATION             }
                               ~~~~~~~~~~
    [ ON SIZE ERROR imperative-statement-1 ]
         ~~~~ ~~~~~
    [ NOT ON SIZE ERROR imperative-statement-2 ]
      ~~~    ~~~~ ~~~~~
[ END-ADD ]
  ~~~~~~~

ADD GIVING Syntax

  ADD { literal-1    }...
  ~~~ { identifier-1 }

    [ TO identifier-2 ]
      ~~
      GIVING { identifier-3
      ~~~~~~
        [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
          ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                            { NEAREST-AWAY-FROM-ZERO }
                            { ~~~~~~~~~~~~~~~~~~~~~~ }
                            { NEAREST-EVEN           }
                            { ~~~~~~~~~~~~           }
                            { NEAREST-TOWARD-ZERO    }
                            { ~~~~~~~~~~~~~~~~~~~    }
                            { PROHIBITED             }
                            { ~~~~~~~~~~             }
                            { TOWARD-GREATER         }
                            { ~~~~~~~~~~~~~~         }
                            { TOWARD-LESSER          }
                            { ~~~~~~~~~~~~~          }
                            { TRUNCATION             }
                              ~~~~~~~~~~
    [ ON SIZE ERROR imperative-statement-1 ]
         ~~~~ ~~~~~
    [ NOT ON SIZE ERROR imperative-statement-2 ]
      ~~~    ~~~~ ~~~~~
[ END-ADD ]
  ~~~~~~~

ADD CORRESPONDING Syntax

  ADD CORRESPONDING identifier-1
  ~~~
      TO identifier-2
      ~~
    [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ]
      ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                        { NEAREST-AWAY-FROM-ZERO }
                        { ~~~~~~~~~~~~~~~~~~~~~~ }
                        { NEAREST-EVEN           }
                        { ~~~~~~~~~~~~           }
                        { NEAREST-TOWARD-ZERO    }
                        { ~~~~~~~~~~~~~~~~~~~    }
                        { PROHIBITED             }
                        { ~~~~~~~~~~             }
                        { TOWARD-GREATER         }
                        { ~~~~~~~~~~~~~~         }
                        { TOWARD-LESSER          }
                        { ~~~~~~~~~~~~~          }
                        { TRUNCATION             }
                          ~~~~~~~~~~
    [ ON SIZE ERROR imperative-statement-1 ]
         ~~~~ ~~~~~
    [ NOT ON SIZE ERROR imperative-statement-2 ]
      ~~~    ~~~~ ~~~~~
[ END-ADD ]
  ~~~~~~~

ALLOCATE Syntax

FORMAT 1. ALLOCATE a "BASED" ITEM.

 ALLOCATE  identifier-1
 ~~~~~~~~
           [{ INITIALIZED } ]  [ RETURNING identifier-3 ]
           [{ ~~~~~~~~~~~ } ]    ~~~~~~~~~
           [{ INITIALISED } ]
           [{ ~~~~~~~~~~~ } ]


FORMAT 2. ALLOCATE a memory block.

 ALLOCATE   arithmetic-expression-1  CHARACTERS
 ~~~~~~~~                            ~~~~~~~~~~
           [{ INITIALIZED } [ TO { identifier-2}] ]  RETURNING identifier-3
           [{ ~~~~~~~~~~~ } [ ~~ {             }] ]  ~~~~~~~~~
           [{ INITIALISED } [    { literal-1   }] ]
           [{ ~~~~~~~~~~~ }                       ]

ALTER Syntax

ALTER procedure-name-1 TO PROCEED TO procedure-name-2
~~~~~                  ~~

CALL Syntax

  CALL [ { STDCALL         } ] { literal-1    }
  ~~~~   { ~~~~~~~         }   { identifier-1 }
         { STATIC          }
         { ~~~~~~          }
         { mnemonic-name-1 }

       [ USING CALL-Argument... ]
         ~~~~~
       [ RETURNING|GIVING identifier-2 ]
         ~~~~~~~~~ ~~~~~~
       [ ON OVERFLOW|EXCEPTION imperative-statement-1 ]
            ~~~~~~~~ ~~~~~~~~~
       [ NOT ON OVERFLOW|EXCEPTION imperative-statement-2 ]
         ~~~    ~~~~~~~~ ~~~~~~~~~
[ END-CALL ]
  ~~~~~~~~

CALL Argument Syntax

[ BY { REFERENCE } ]
     { ~~~~~~~~~ }
     { CONTENT   }
     { ~~~~~~~   }
     { VALUE     }
       ~~~~~

     { OMITTED                                                   }
     { ~~~~~~~                                                   }
     { [ UNSIGNED ] [ SIZE IS { AUTO      } ] [ { literal-2    } }
         ~~~~~~~~     ~~~~    { ~~~~      }     { identifier-2 }
                              { DEFAULT   }
                              { ~~~~~~~   }
                              { integer-1 }

CANCEL Syntax

CANCEL { literal-1    }...
~~~~~~ { identifier-1 }

CLOSE Syntax

CLOSE { file-name-1 [ { REEL|UNIT [ FOR REMOVAL ] } ] }...
~~~~~                 { ~~~~ ~~~~       ~~~~~~~   }
                      { WITH LOCK                 }
                      {      ~~~~                 }
                      { WITH NO REWIND            }
                             ~~ ~~~~~~

The REEL, LOCK and NO REWINDclauses are syntactically recognized but are otherwise non-functional, except for the CLOSE...NO REWIND statement, which will generate a file status of 07 rather than the usual 00 (but take no other action).

COMMIT Syntax

COMMIT
~~~~~~

COMPUTE Syntax

  COMPUTE { identifier-1
  ~~~~~~~
      [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] }...
        ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                          { NEAREST-AWAY-FROM-ZERO }
                          { ~~~~~~~~~~~~~~~~~~~~~~ }
                          { NEAREST-EVEN           }
                          { ~~~~~~~~~~~~           }
                          { NEAREST-TOWARD-ZERO    }
                          { ~~~~~~~~~~~~~~~~~~~    }
                          { PROHIBITED             }
                          { ~~~~~~~~~~             }
                          { TOWARD-GREATER         }
                          { ~~~~~~~~~~~~~~         }
                          { TOWARD-LESSER          }
                          { ~~~~~~~~~~~~~          }
                          { TRUNCATION             }
                            ~~~~~~~~~~
        = | EQUAL arithmetic-expression-1
          ~~~~~
      [ ON SIZE ERROR imperative-statement-1 ]
           ~~~~ ~~~~~
      [ NOT ON SIZE ERROR imperative-statement-2 ]
        ~~~    ~~~~ ~~~~~
[ END-COMPUTE ]
  ~~~~~~~~~~~

CONTINUE Syntax

CONTINUE
~~~~~~~~

                { identifier-1            }
CONTINUE AFTER  { literal-1               }   SECONDS
~~~~~~~~ ~~~~~  { arithmetic-expression-1 }   ~~~~~~~

DELETE Syntax

  DELETE file-name-1 RECORD
  ~~~~~~
    [ INVALID KEY imperative-statement-1 ]
      ~~~~~~~
    [ NOT INVALID KEY imperative-statement-2 ]
      ~~~ ~~~~~~~
[ END-DELETE ]
  ~~~~~~~~~~

DISPLAY UPON Device Syntax

  DISPLAY { literal-1    }...
  ~~~~~~~ { identifier-1 }
     [ UPON mnemonic-name-1 ]
       ~~~~
     [ WITH NO ADVANCING ]
            ~~ ~~~~~~~~~
     [ ON EXCEPTION imperative-statement-1 ]
          ~~~~~~~~~
     [ NOT ON EXCEPTION imperative-statement-2 ]
       ~~~    ~~~~~~~~~
[ END-DISPLAY ]
  ~~~~~~~~~~~

DISPLAY UPON COMMAND-LINE Syntax

  DISPLAY { literal-1    }...
  ~~~~~~~ { identifier-1 }
       UPON { ARGUMENT-NUMBER|COMMAND-LINE }
       ~~~~ { ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ }
     [ ON EXCEPTION imperative-statement-1 ]
          ~~~~~~~~~
     [ NOT ON EXCEPTION imperative-statement-2 ]
       ~~~    ~~~~~~~~~
[ END-DISPLAY ]
  ~~~~~~~~~~~

DISPLAY UPON ENVIRONMENT-NAME Syntax

  DISPLAY { literal-1    }... UPON { ENVIRONMENT-VALUE }
  ~~~~~~~ { identifier-1 }    ~~~~ { ~~~~~~~~~~~~~~~~~ }
                                   { ENVIRONMENT-NAME  }
                                     ~~~~~~~~~~~~~~~~
     [ ON EXCEPTION imperative-statement-1 ]
          ~~~~~~~~~
     [ NOT ON EXCEPTION imperative-statement-2 ]
       ~~~    ~~~~~~~~~
[ END-DISPLAY ]
  ~~~~~~~~~~~

DISPLAY Data-Item Syntax

DISPLAY identifier-1 [ UPON CRT|CRT-UNDER ]
~~~~~~~                ~~~~ ~~~ ~~~~~~~~~
        OMITTED
        ~~~~~~~
    [ AT { | LINE NUMBER { integer-1    }            | } ]
      ~~ { | ~~~~        { identifier-2 }            | }
         { | COLUMN|COL|POSITION|POS NUMBER { integer-2    }
         { | ~~~~~~ ~~~ ~~~~~~~~ ~~~        { identifier-3 }
         {                                             }
         { { integer-3    }                            }
         { { identifier-4 }                            }

    [ WITH [ Attribute-Specification ]...
      ~~~~
           [ SCROLL { UP   } [ { integer-4    } LINE|LINES ] ]
             ~~~~~~ { ~~   }   { identifier-5 }
                    { DOWN }
                      ~~~~
           [ SIZE { integer-5    }
             ~~~~ { identifier-6 }  ]
           [ CONTROL  { literal-7    } ]
             ~~~~~~~  { identifier-7 }
           [ COLOR  { IS } { integer-8    } ]
             COLOUR { IS } { identifier-8 } ]
               ~~~~~~
           [ NO ADVANCING ]
             ~~~~~~~~~~~~
    [ ON EXCEPTION imperative-statement-1 ]
         ~~~~~~~~~
    [ NOT ON EXCEPTION imperative-statement-2 ]
      ~~~    ~~~~~~~~~
[ END-DISPLAY ]
  ~~~~~~~~~~~

The UPON CRT, UPON CRT-UNDER and CONVERSIONclauses are syntactically recognized but are otherwise non-functional. They are supported to provide compatibility with COBOL source written for other COBOL implementations.

DISPLAY data-item (Microsoft format) Syntax

DISPLAY  [position-spec] {identifier-2 | literal-1} ...
~~~~~~~

  [ WITH [ Attribute-Specification ]...
    ~~~~
         [ ERASE  { SCREEN|LINE }  ]
         [ SCROLL { UP   } [ { integer-3    } LINE|LINES ] ]
           ~~~~~~  { ~~   }   { identifier-3 }
                                     { DOWN }
                                       ~~~~
         [ SIZE { integer-4    }
           ~~~~ { identifier-4 } ]
[ END-DISPLAY ]
  ~~~~~~~~~~~


  where  position-spec is
  { (position-spec-num, position-spec-num) }
  { (,position-spec-num)                   }
  { (position-spec-num,)                   }

  where  position-spec-num  is
  { identifier-1 } [{ + } integer-1 ]
  { integer-2    } [{ - }           ]

DIVIDE INTO Syntax

DIVIDE { literal-1    } INTO { literal-2    } GIVING { identifier-3
~~~~~~ { identifier-1 } ~~~~ { identifier-2 } ~~~~~~

           [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
             ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                               { NEAREST-AWAY-FROM-ZERO }
                               { ~~~~~~~~~~~~~~~~~~~~~~ }
                               { NEAREST-EVEN           }
                               { ~~~~~~~~~~~~           }
                               { NEAREST-TOWARD-ZERO    }
                               { ~~~~~~~~~~~~~~~~~~~    }
                               { PROHIBITED             }
                               { ~~~~~~~~~~             }
                               { TOWARD-GREATER         }
                               { ~~~~~~~~~~~~~~         }
                               { TOWARD-LESSER          }
                               { ~~~~~~~~~~~~~          }
                               { TRUNCATION             }
                                 ~~~~~~~~~~
   [ REMAINDER identifier-4 ]
     ~~~~~~~~~
   [ ON SIZE ERROR imperative-statement-1 ]
        ~~~~ ~~~~~
   [ NOT ON SIZE ERROR imperative-statement-2 ]
     ~~~    ~~~~ ~~~~~
[ END-DIVIDE ]
  ~~~~~~~~~~
For further clarification, the following examples are provided to be used with
the various flavours of the DIVIDE statement when using BY, INTO and GIVING.

--------------------------------------+---+-----+--------------+-------------------+
DIVIDE Operation                      | A |  B  |      C       |         D         |
--------------------------------------+---+-----+--------------+-------------------+
DIVIDE A INTO B                       | A | B/A |              |                   |
--------------------------------------+---+-----+--------------+-------------------+
DIVIDE A INTO B GIVING C              | A |  B  |     B/A      |                   |
--------------------------------------+---+-----+--------------+-------------------+
DIVIDE A BY B GIVING C                | A |  B  |     A/B      |                   |
--------------------------------------+---+-----+--------------+-------------------+
DIVIDE A INTO B GIVING C REMAINDER D  | A |  B  | Integer(B/A) | Integer remainder |
--------------------------------------+---+-----+--------------+-------------------+

DIVIDE INTO GIVING Syntax

DIVIDE { literal-1    } INTO { literal-2    } GIVING { identifier-3
~~~~~~ { identifier-1 } ~~~~ { identifier-2 } ~~~~~~

           [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
             ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                               { NEAREST-AWAY-FROM-ZERO }
                               { ~~~~~~~~~~~~~~~~~~~~~~ }
                               { NEAREST-EVEN           }
                               { ~~~~~~~~~~~~           }
                               { NEAREST-TOWARD-ZERO    }
                               { ~~~~~~~~~~~~~~~~~~~    }
                               { PROHIBITED             }
                               { ~~~~~~~~~~             }
                               { TOWARD-GREATER         }
                               { ~~~~~~~~~~~~~~         }
                               { TOWARD-LESSER          }
                               { ~~~~~~~~~~~~~          }
                               { TRUNCATION             }
                                 ~~~~~~~~~~
   [ REMAINDER identifier-4 ]
     ~~~~~~~~~
   [ ON SIZE ERROR imperative-statement-1 ]
        ~~~~ ~~~~~
   [ NOT ON SIZE ERROR imperative-statement-2 ]
     ~~~    ~~~~ ~~~~~
[ END-DIVIDE ]
  ~~~~~~~~~~

DIVIDE BY GIVING Syntax

DIVIDE { literal-1    } BY { literal-2    } GIVING { identifier-3
~~~~~~ { identifier-1 } ~~ { identifier-2 } ~~~~~~

           [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
             ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                               { NEAREST-AWAY-FROM-ZERO }
                               { ~~~~~~~~~~~~~~~~~~~~~~ }
                               { NEAREST-EVEN           }
                               { ~~~~~~~~~~~~           }
                               { NEAREST-TOWARD-ZERO    }
                               { ~~~~~~~~~~~~~~~~~~~    }
                               { PROHIBITED             }
                               { ~~~~~~~~~~             }
                               { TOWARD-GREATER         }
                               { ~~~~~~~~~~~~~~         }
                               { TOWARD-LESSER          }
                               { ~~~~~~~~~~~~~          }
                               { TRUNCATION             }
                                 ~~~~~~~~~~
   [ REMAINDER identifier-4 ]
     ~~~~~~~~~
   [ ON SIZE ERROR imperative-statement-1 ]
        ~~~~ ~~~~~
   [ NOT ON SIZE ERROR imperative-statement-2 ]
     ~~~    ~~~~ ~~~~~
[ END-DIVIDE ]
  ~~~~~~~~~~

ENTRY Syntax

ENTRY [ call-convention-phrase ] literal-1
~~~~~
    [ linkage-phrase ]

 [ USING ENTRY-Argument ... ]
   ~~~~~

Format 2 (Special purpose and for GO TO )

ENTRY FOR GO TO literal-3
~~~~~ ~~~ ~~ ~~

ENTRY-Argument Syntax

[ BY { REFERENCE } ] { OMITTED }
     { ~~~~~~~~~ }
     { CONTENT   } ] { [ size-phrase ] { identifier-1 } }
     { ~~~~~~~   }                     { literal-2    } }
     { VALUE     } ] { [ size-phrase ] { identifier-1 } }
       ~~~~~                           { literal-2    } }

EVALUATE Syntax

  EVALUATE Selection-Subject-1 [ ALSO Selection-Subject-2 ]...
  ~~~~~~~~                       ~~~~
{ { WHEN Selection-Object-1 [ ALSO Selection-Object-2 ] }...
    ~~~~                      ~~~~
        [ imperative-statement-1 ] }...
  [ WHEN OTHER
    ~~~~ ~~~~~
        imperative-statement-other ]

[ END-EVALUATE ]
  ~~~~~~~~~~~~

EVALUATE Selection Subject Syntax

{ TRUE         }
{ ~~~~         }
{ FALSE        }
{ ~~~~~        }
{ expression-1 }
{ identifier-1 }
{ literal-1    }

EVALUATE Selection Object Syntax

{ ANY                                                }
{ ~~~                                                }
{ TRUE                                               }
{ ~~~~                                               }
{ FALSE                                              }
{ ~~~~~                                              }
{ partial-expression-1                               }
{                                                    }
{ { expression-2 } [ THRU|THROUGH { expression-3 } ] }
{ { identifier-2 }   ~~~~ ~~~~~~~ { identifier-3 }   }
{ { literal-2    }                { literal-3    }   }

EXAMINE Syntax

EXAMINE { identifier } TALLYING
~~~~~~~                ~~~~~~~~
    { ALL|LEADING|UNTIL FIRST } literal-1  REPLACING BY literal-2
      ~~~ ~~~~~~~ ~~~~~~~~~~~              ~~~~~~~~~~~~

EXAMINE { identifier } REPLACING { ALL|FIRST|LEADING|UNTIL FIRST }
~~~~~~~                ~~~~~~~~~   ~~~ ~~~~~ ~~~~~~~ ~~~~~~~~~~~
      literal-3 BY literal-4
                ~~

EXHIBIT Syntax

EXHIBIT [CHANGED][NAMED] [position-spec] [ERASE] {identifier-1 | literal-1} ...
~~~~~~~  ~~~~~~~  ~~~~~                   ~~~~~
        [UPON mnemonic-name-1]
         ~~~~

where position-spec is

  {(position-spec-num, position-spec-num)}
  {(, position-spec-num)                 }
  {(position-spec-num, )                 }

where position-spec-num is

  {identifier-2} [{+} integer-2]
  {integer-1   } [{-}          ]

EXIT Syntax

EXIT [ { PROGRAM           }   [ { RETURNING } ] { identifier-1 } ]
~~~~                           [ { GIVING    } ] { literal-1    } ]
       { FUNCTION          } ]
       { ~~~~~~~~          } ]
       { PERFORM [ CYCLE ] } ]
       { ~~~~~~~   ~~~~~   } ]
       { SECTION           } ]
       { ~~~~~~~           } ]
       { PARAGRAPH         } ]
         ~~~~~~~~~

FREE Syntax

FREE { [ ADDRESS OF ] identifier-1 }...
~~~~     ~~~~~~~

GENERATE Syntax

GENERATE { report-name-1 }
~~~~~~~~ { identifier-1  }

GOBACK Syntax

GOBACK [ { RETURNING|GIVING { literal-1    }  ]
~~~~~~   { ~~~~~~~~~ ~~~~~~ { identifier-1 }

Simple GO TO Syntax

GO TO procedure-name-1
~~
GO TO ENTRY literal-3
~~    ~~~~~

GO TO DEPENDING ON Syntax

GO TO {procedure-name-1} ...
~~
                             DEPENDING ON identifier-1
                             ~~~~~~~~~
GO TO ENTRY {literal-3} ...
~~    ~~~~~
                             DEPENDING ON identifier-1
                             ~~~~~~~~~

IF Syntax

  IF conditional-expression
  ~~
  THEN { imperative-statement-1 }
       { NEXT SENTENCE          }
         ~~~~ ~~~~~~~~
[ ELSE { imperative-statement-2 } ]
  ~~~~ { NEXT SENTENCE          }
         ~~~~ ~~~~~~~~
[ END-IF ]
  ~~~~~~

INITIALIZE Syntax

INITIALIZE|INITIALISE identifier-1...
~~~~~~~~~~ ~~~~~~~~~~
    [ WITH FILLER ]
           ~~~~~~
    [ { category-name-1 } TO VALUE ]
      { ALL             }    ~~~~~
        ~~~
    [ THEN REPLACING { category-name-2 DATA BY
           ~~~~~~~~~                        ~~
          [ LENGTH OF ] { literal-1    } }... ]
            ~~~~~~      { identifier-1 }

    [ THEN TO DEFAULT ]
              ~~~~~~~

INITIATE Syntax

INITIATE report-name-1
~~~~~~~~

INSPECT Syntax

INSPECT { literal-1            }
~~~~~~~ { identifier-1         }
        { function-reference-1 }

 [ TALLYING { identifier-2 FOR { ALL|LEADING|TRAILING { literal-2    } }
   ~~~~~~~~                ~~~ { ~~~ ~~~~~~~ ~~~~~~~~ { identifier-3 } }
                               { CHARACTERS                            }
                                 ~~~~~~~~~~
              [ | { AFTER|BEFORE } INITIAL { literal-3    } | ] }... ]
                |   ~~~~~ ~~~~~~           { identifier-4 } |

 [ REPLACING { { { ALL|FIRST|LEADING|TRAILING { literal-4    } }
   ~~~~~~~~~   { { ~~~ ~~~~~ ~~~~~~~ ~~~~~~~~ { identifier-5 } }
               { CHARACTERS                                    }
               { ~~~~~~~~~~                                    }

                BY { [ ALL ] literal-5 }
                ~~ {   ~~~             }
                   { identifier-6      }

              [ | { AFTER|BEFORE } INITIAL { literal-6    } | ] }... ]
                |   ~~~~~ ~~~~~~           { identifier-7 } |

 [ CONVERTING { { literal-7    } TO { literal-8    }
   ~~~~~~~~~~   { identifier-8 } ~~ { identifier-9 }

              [ | { AFTER|BEFORE } INITIAL { literal-9     } | ] ]
                |   ~~~~~ ~~~~~~           { identifier-10 } |

MERGE Syntax

MERGE sort-file-1
~~~~~
   { ON { ASCENDING  } KEY identifier-1... }...
        { ~~~~~~~~~  }
        { DESCENDING }
          ~~~~~~~~~~
   [ WITH DUPLICATES IN ORDER ]
          ~~~~~~~~~~
   [ COLLATING SEQUENCE IS alphabet-name-1 ]
     ~~~~~~~~~
     USING file-name-1 file-name-2...
     ~~~~~
   { OUTPUT PROCEDURE IS procedure-name-1    }
   { ~~~~~~ ~~~~~~~~~                        }
   {       [ THRU|THROUGH procedure-name-2 ] }
   {         ~~~~ ~~~~~~~                    }
   { GIVING file-name-3...                   }
   { ~~~~~~                                  }

The DUPLICATES clause is syntactically recognized but is otherwise non-functional.

Simple MOVE Syntax

MOVE { literal-1    } TO identifier-2...
~~~~ { identifier-1 } ~~

MOVE CORRESPONDING Syntax

MOVE CORRESPONDING identifier-1 TO identifier-2...
~~~~ ~~~~                       ~~

MULTIPLY BY Syntax

MULTIPLY { literal-1    } BY { identifier-2
~~~~~~~~ { identifier-1 } ~~

     [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
       ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                         { NEAREST-AWAY-FROM-ZERO }
                         { ~~~~~~~~~~~~~~~~~~~~~~ }
                         { NEAREST-EVEN           }
                         { ~~~~~~~~~~~~           }
                         { NEAREST-TOWARD-ZERO    }
                         { ~~~~~~~~~~~~~~~~~~~    }
                         { PROHIBITED             }
                         { ~~~~~~~~~~             }
                         { TOWARD-GREATER         }
                         { ~~~~~~~~~~~~~~         }
                         { TOWARD-LESSER          }
                         { ~~~~~~~~~~~~~          }
                         { TRUNCATION             }
                           ~~~~~~~~~~
   [ ON SIZE ERROR imperative-statement-1 ]
        ~~~~ ~~~~~
   [ NOT ON SIZE ERROR imperative-statement-2 ]
     ~~~    ~~~~ ~~~~~
[ END-MULTIPLY ]
  ~~~~~~~~~~~~

MULTIPLY GIVING Syntax

MULTIPLY { literal-1    } BY { literal-2    } GIVING { identifier-3
~~~~~~~~ { identifier-1 } ~~ { identifier-2 } ~~~~~~

     [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
       ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                         { NEAREST-AWAY-FROM-ZERO }
                         { ~~~~~~~~~~~~~~~~~~~~~~ }
                         { NEAREST-EVEN           }
                         { ~~~~~~~~~~~~           }
                         { NEAREST-TOWARD-ZERO    }
                         { ~~~~~~~~~~~~~~~~~~~    }
                         { PROHIBITED             }
                         { ~~~~~~~~~~             }
                         { TOWARD-GREATER         }
                         { ~~~~~~~~~~~~~~         }
                         { TOWARD-LESSER          }
                         { ~~~~~~~~~~~~~          }
                         { TRUNCATION             }
                           ~~~~~~~~~~
   [ ON SIZE ERROR imperative-statement-1 ]
        ~~~~ ~~~~~
   [ NOT ON SIZE ERROR imperative-statement-2 ]
     ~~~    ~~~~ ~~~~~
[ END-MULTIPLY ]
  ~~~~~~~~~~~~

OPEN Syntax

OPEN { { INPUT  } [ SHARING WITH { ALL OTHER } ] file-name-1
~~~~   { ~~~~~  }   ~~~~~~~      { ~~~       }
       { OUTPUT }                { NO OTHER  }
       { ~~~~~~ }                { ~~        }
       { I-O    }                { READ ONLY }
       { ~~~    }                  ~~~~ ~~~~
       { EXTEND }
         ~~~~~~
     [ { REVERSED           } ] }...
       { ~~~~~~~~           }
       { WITH { NO REWIND } }
       {      { ~~ ~~~~~~ } }
       {      { LOCK      } }
                ~~~~

The NO REWIND, and REVERSEDclauses are syntactically recognized but are otherwise non-functional.

Procedural PERFORM Syntax

PERFORM procedure-name-1 [ THRU|THROUGH procedure-name-2 ]
~~~~~~~                    ~~~~ ~~~~~~~
   [ { [ WITH TEST { BEFORE } ] { VARYING-Clause                 } } ]
     {        ~~~~ { ~~~~~~ }   { UNTIL conditional-expression-1 } }
     {             { AFTER  }     ~~~~~                            }
     {               ~~~~~                                         }
     { UNTIL EXIT|FOREVER                                          }
     { ~~~~~ ~~~~ ~~~~~~~                                          }
     { { literal-1    } TIMES                                      }
     { { identifier-1 } ~~~~~                                      }

Inline PERFORM Syntax

  PERFORM
  ~~~~~~~
   [ { [ WITH TEST { BEFORE } ] { VARYING-Clause                 } } ]
     {        ~~~~ { ~~~~~~ }   { UNTIL conditional-expression-1 } }
     {             { AFTER  }     ~~~~~                            }
     {               ~~~~~                                         }
     { UNTIL EXIT|FOREVER                                          }
     { ~~~~~ ~~~~ ~~~~~~~                                          }
     { { literal-1    } TIMES                                      }
     { { identifier-1 } ~~~~~                                      }

     imperative-statement-1

[ END-PERFORM ]
  ~~~~~~~~~~~

VARYING Syntax

VARYING identifier-2 FROM { literal-2    } [ BY { literal-3    } ]
~~~~~~~              ~~~~ { identifier-3 }   ~~ { identifier-4 }
        [ UNTIL conditional-expression-1 ]
          ~~~~~
[ AFTER identifier-5 FROM { literal-4    } [ BY { literal-5    } ]
  ~~~~~              ~~~~ { identifier-6 }   ~~ { identifier-7 }
        [ UNTIL conditional-expression-2 ] ]...
          ~~~~~

Sequential READ Syntax

  READ file-name-1 [ { NEXT|PREVIOUS } ] RECORD [ INTO identifier-1 ]
  ~~~~               { ~~~~ ~~~~~~~~ }            ~~~~
   [ { IGNORING LOCK    } ]
     { ~~~~~~~~ ~~~~    }
     { WITH [ NO ] LOCK }
     {        ~~   ~~~~ }
     { WITH KEPT LOCK   }
     {      ~~~~ ~~~~   }
     { WITH IGNORE LOCK }
     {      ~~~~~~ ~~~~ }
     { WITH WAIT        }
            ~~~~
   [ AT END imperative-statement-1 ]
        ~~~
   [ NOT AT END imperative-statement-2 ]
     ~~~    ~~~
[ END-READ ]
  ~~~~~~~~

Random READ Syntax

  READ file-name-1 RECORD [ INTO identifier-1 ]
  ~~~~                      ~~~~
   [ { IGNORING LOCK    } ]
     { ~~~~~~~~ ~~~~    }
     { WITH [ NO ] LOCK }
     {        ~~   ~~~~ }
     { WITH KEPT LOCK   }
     {      ~~~~ ~~~~   }
     { WITH IGNORE LOCK }
     {      ~~~~~~ ~~~~ }
     { WITH WAIT        }
            ~~~~
   [ KEY IS identifier-2 ]
     ~~~
   [ INVALID KEY imperative-statement-1 ]
     ~~~~~~~
   [ NOT INVALID KEY imperative-statement-2 ]
     ~~~ ~~~~~~~
[ END-READ ]
  ~~~~~~~~

READY TRACE Syntax

READY TRACE
~~~~~ ~~~~~

RELEASE Syntax

RELEASE record-name-1 [ FROM { literal-1    } ]
~~~~~~~                 ~~~~ { identifier-1 }

RESET TRACE Syntax

RESET TRACE
~~~~~ ~~~~~

RETURN Syntax

  RETURN sort-file-name-1 RECORD
  ~~~~~~
   [ INTO identifier-1 ]
     ~~~~
     AT END imperative-statement-1
        ~~~
   [ NOT AT END imperative-statement-2 ]
     ~~~    ~~~
[ END-RETURN ]
  ~~~~~~~~~~

REWRITE Syntax

  REWRITE record-name-1
  ~~~~~~~
     [ FROM { literal-1    } ]
       ~~~~ { identifier-1 }

     [ WITH [ NO ] LOCK ]
              ~~   ~~~~
     [ INVALID KEY imperative-statement-1 ]
       ~~~~~~~
     [ NOT INVALID KEY imperative-statement-2 ]
       ~~~ ~~~~~~~
[ END-REWRITE ]
  ~~~~~~~~~~~

ROLLBACK Syntax

ROLLBACK
~~~~~~~~

SEARCH Syntax

  SEARCH table-name-1
  ~~~~~~
     [ VARYING index-name-1 ]
       ~~~~~~~
     [ AT END imperative-statement-1 ]
          ~~~
     { WHEN conditional-expression-1 imperative-statement-2 }...
       ~~~~
[ END-SEARCH ]
  ~~~~~~~~~~

SEARCH ALL Syntax

  SEARCH ALL table-name-1
  ~~~~~~ ~~~
     [ AT END imperative-statement-1 ]
          ~~~
       WHEN conditional-expression-1 imperative-statement-2
       ~~~~
[ END-SEARCH ]
  ~~~~~~~~~~

SET ENVIRONMENT Syntax

SET ENVIRONMENT { literal-1    } TO { literal-2    }
~~~ ~~~~~~~~~~~ { identifier-1 } ~~ { identifier-2 }

SET Program-Pointer Syntax

SET program-pointer-1 TO ENTRY { literal-1    }
~~~                   ~~ ~~~~~ { identifier-1 }

SET ADDRESS Syntax

SET [ ADDRESS OF ] { pointer-name-1 }...
~~~   ~~~~~~~ ~~   { identifier-1   }

    TO [ ADDRESS OF ]  { pointer-name-2 }
    ~~   ~~~~~~~ ~~    { identifier-2   }

SET Index Syntax

SET index-name-1 TO { literal-1    }
~~~              ~~ { identifier-2 }

SET UP/DOWN Syntax

SET identifier-1 { UP   } BY [ LENGTH OF ] { literal-1    }
~~~              { ~~   } ~~   ~~~~~~ ~~   { identifier-2 }
                 { DOWN }
                   ~~~~

SET Condition Name Syntax

SET condition-name-1... TO { TRUE  }
~~~                     ~~ { ~~~~  }
                           { FALSE }
                             ~~~~~

SET Switch Syntax

SET mnemonic-name-1... TO { ON  }
~~~                    ~~ { ~~  }
                          { OFF }
                            ~~~

SET ATTRIBUTE Syntax

SET identifier-1 ATTRIBUTE { { BELL          } { ON  }...
~~~              ~~~~~~~~~   { ~~~~          } { ~~  }
                             { BLINK         } { OFF }
                             { ~~~~~         }   ~~~
                             { HIGHLIGHT     }
                             { ~~~~~~~~~     }
                             { LEFTLINE      }
                             { ~~~~~~~~      }
                             { LOWLIGHT      }
                             { ~~~~~~~~      }
                             { OVERLINE      }
                             { ~~~~~~~~      }
                             { REVERSE-VIDEO }
                             { ~~~~~~~~~~~~~ }
                             { UNDERLINE     }
                               ~~~~~~~~~

SET LAST EXCEPTION Syntax

SET LAST EXCEPTION TO { OFF }
~~~ ~~~~ ~~~~~~~~~ ~~   ~~~

File-Based SORT Syntax

SORT sort-file-1
~~~~
   { ON { ASCENDING  } KEY identifier-1... }...
        { ~~~~~~~~~  }
        { DESCENDING }
          ~~~~~~~~~~
   [ WITH DUPLICATES IN ORDER ]
          ~~~~~~~~~~
   [ COLLATING SEQUENCE IS alphabet-name-1 ]
     ~~~~~~~~~

   { INPUT PROCEDURE IS procedure-name-1      }
   { ~~~~~~ ~~~~~~~~~                         }
   {       [ THRU|THROUGH procedure-name-2 ]  }
   {         ~~~~ ~~~~~~~                     }
   { USING file-name-1...                     }
     ~~~~~
   { OUTPUT PROCEDURE IS procedure-name-3     }
   { ~~~~~~ ~~~~~~~~~                         }
   {       [ THRU|THROUGH procedure-name-4 ]  }
   {         ~~~~ ~~~~~~~                     }
   { GIVING file-name-2...                    }
     ~~~~~~

The DUPLICATES clause is syntactically recognized but is otherwise non-functional.

Table SORT Syntax

SORT table-name-1
~~~~
   { ON { ASCENDING  } KEY identifier-1... }...
        { ~~~~~~~~~  }
        { DESCENDING }
          ~~~~~~~~~~
   [ WITH DUPLICATES IN ORDER ]
          ~~~~~~~~~~
   [ COLLATING SEQUENCE IS alphabet-name-1 ]
     ~~~~~~~~~

The DUPLICATES clause is syntactically recognized but is otherwise non-functional.

START Syntax

  START file-name-1
  ~~~~~
    [ { FIRST                                                    } ]
      { ~~~~~                                                    }
      { LAST                                                     }
      { ~~~~                                                     }
      { KEY { IS EQUAL TO | IS = | EQUALS         } identifier-1 }
        ~~~ {    ~~~~~             ~~~~~~         }
            { IS GREATER THAN | IS >              }
            {    ~~~~~~~                          }
            { IS GREATER THAN OR EQUAL TO | IS >= }
            {    ~~~~~~~      ~~ ~~~~~            }
            { IS NOT LESS THAN                    }
            {    ~~~ ~~~~                         }
            { IS LESS THAN | IS <                 }
            {    ~~~~                             }
            { IS LESS THAN OR EQUAL TO | IS <=    }
            {    ~~~~      ~~ ~~~~~               }
            { IS NOT GREATER THAN                 }
                 ~~~ ~~~~~~~

       [ WITH {SIZE}   arithmetic-expression ]
               ~~~~
       [      {LENGTH} arithmetic-expression ]
               ~~~~~~

   [ INVALID KEY imperative-statement-1 ]
     ~~~~~~~
   [ NOT INVALID KEY imperative-statement-2 ]
     ~~~ ~~~~~~~
[ END-START ]
  ~~~~~~~~~

STOP Syntax

STOP { RUN [ { RETURNING|GIVING { literal-1    }           } ] }
~~~~ { ~~~   { ~~~~~~~~~ ~~~~~~ { identifier-1 }           }   }
     {       {                                             }   }
     {       { WITH { ERROR  } STATUS [ { literal-2    } ] }   }
     {       {      { ~~~~~  }          { identifier-2 }   }   }
     {       {      { NORMAL }                             }   }
     {                ~~~~~~                                   }
     { literal-3                                               }

STRING Syntax

  STRING
  ~~~~~~
     { { literal-1    } [ DELIMITED BY { SIZE         } ] }...
       { identifier-1 }   ~~~~~~~~~    { ~~~~         }
                                       { literal-2    }
                                       { identifier-2 }
       INTO identifier-3
       ~~~~
     [ WITH POINTER identifier-4 ]
            ~~~~~~~
     [ ON OVERFLOW imperative-statement-1 ]
          ~~~~~~~~
     [ NOT ON OVERFLOW imperative-statement-2 ]
       ~~~    ~~~~~~~~
[ END-STRING ]
  ~~~~~~~~~~

SUBTRACT FROM Syntax

  SUBTRACT { literal-1    }... FROM { identifier-2
  ~~~~~~~~ { identifier-1 }    ~~~~

         [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
           ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                             { NEAREST-AWAY-FROM-ZERO }
                             { ~~~~~~~~~~~~~~~~~~~~~~ }
                             { NEAREST-EVEN           }
                             { ~~~~~~~~~~~~           }
                             { NEAREST-TOWARD-ZERO    }
                             { ~~~~~~~~~~~~~~~~~~~    }
                             { PROHIBITED             }
                             { ~~~~~~~~~~             }
                             { TOWARD-GREATER         }
                             { ~~~~~~~~~~~~~~         }
                             { TOWARD-LESSER          }
                             { ~~~~~~~~~~~~~          }
                             { TRUNCATION             }
                               ~~~~~~~~~~
    [ ON SIZE ERROR imperative-statement-1 ]
         ~~~~ ~~~~~
    [ NOT ON SIZE ERROR imperative-statement-2 ]
      ~~~    ~~~~ ~~~~~
[ END-SUBTRACT ]
  ~~~~~~~~~~~~

SUBTRACT GIVING Syntax

  SUBTRACT { literal-1    }... FROM identifier-2
  ~~~~~~~~ { identifier-1 }    ~~~~

      GIVING { identifier-3
      ~~~~~~
         [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ] }...
           ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                             { NEAREST-AWAY-FROM-ZERO }
                             { ~~~~~~~~~~~~~~~~~~~~~~ }
                             { NEAREST-EVEN           }
                             { ~~~~~~~~~~~~           }
                             { NEAREST-TOWARD-ZERO    }
                             { ~~~~~~~~~~~~~~~~~~~    }
                             { PROHIBITED             }
                             { ~~~~~~~~~~             }
                             { TOWARD-GREATER         }
                             { ~~~~~~~~~~~~~~         }
                             { TOWARD-LESSER          }
                             { ~~~~~~~~~~~~~          }
                             { TRUNCATION             }
                               ~~~~~~~~~~
    [ ON SIZE ERROR imperative-statement-1 ]
         ~~~~ ~~~~~
    [ NOT ON SIZE ERROR imperative-statement-2 ]
      ~~~    ~~~~ ~~~~~
[ END-SUBTRACT ]
  ~~~~~~~~~~~~

SUBTRACT CORRESPONDING Syntax

  SUBTRACT CORRESPONDING identifier-1 FROM identifier-2
  ~~~~~~~~                            ~~~~
    [ ROUNDED [ MODE IS { AWAY-FROM-ZERO         } ] ]
      ~~~~~~~   ~~~~    { ~~~~~~~~~~~~~~         }
                        { NEAREST-AWAY-FROM-ZERO }
                        { ~~~~~~~~~~~~~~~~~~~~~~ }
                        { NEAREST-EVEN           }
                        { ~~~~~~~~~~~~           }
                        { NEAREST-TOWARD-ZERO    }
                        { ~~~~~~~~~~~~~~~~~~~    }
                        { PROHIBITED             }
                        { ~~~~~~~~~~             }
                        { TOWARD-GREATER         }
                        { ~~~~~~~~~~~~~~         }
                        { TOWARD-LESSER          }
                        { ~~~~~~~~~~~~~          }
                        { TRUNCATION             }
                          ~~~~~~~~~~
    [ ON SIZE ERROR imperative-statement-1 ]
         ~~~~ ~~~~~
    [ NOT ON SIZE ERROR imperative-statement-2 ]
      ~~~    ~~~~ ~~~~~
[ END-SUBTRACT ]
  ~~~~~~~~~~~~

SUPPRESS Syntax

SUPPRESS PRINTING
~~~~~~~~

TERMINATE Syntax

TERMINATE report-name-1...
~~~~~~~~~

TRANSFORM Syntax

TRANSFORM identifier-1 CHARACTERS FROM { literal-1    } TO { literal-2    }
~~~~~~~~~                         ~~~~ { identifier-2 } ~~ { identifier-3 }

UNLOCK Syntax

UNLOCK filename-1 RECORD|RECORDS
~~~~~~

UNSTRING Syntax

  UNSTRING identifier-1
  ~~~~~~~~
       DELIMITED BY { [ ALL ] literal-1 } [ OR { [ ALL ] literal-2 } ]...
       ~~~~~~~~~    {   ~~~             }   ~~ {   ~~~             }
                    { identifier-2      }      { identifier-3      }

       INTO { identifier-4
       ~~~~ [ DELIMITER IN identifier-5 ] [ COUNT IN identifier-6 ] }...
              ~~~~~~~~~                     ~~~~~
     [ WITH POINTER identifier-7 ]
            ~~~~~~~
     [ TALLYING IN identifier-8 ]
       ~~~~~~~~
     [ ON OVERFLOW imperative-statement-1 ]
          ~~~~~~~~
     [ NOT ON OVERFLOW imperative-statement-2 ]
       ~~~    ~~~~~~~~
[ END-UNSTRING ]
  ~~~~~~~~~~~~

WRITE Syntax

  WRITE record-name-1
  ~~~~~
     [ FROM { literal-1    } ]
       ~~~~ { identifier-1 }

     [ WITH [ NO ] LOCK ]
              ~~   ~~~~
     [ { BEFORE } ADVANCING { { literal-2    } LINE|LINES } ]
       { ~~~~~~ }           { { identifier-2              }
       { AFTER  }           { PAGE                        }
         ~~~~~              { ~~~~                        }
                            { mnemonic-name-1             }

     [ AT END-OF-PAGE|EOP imperative-statement-1 ]
          ~~~~~~~~~~~ ~~~
     [ NOT AT END-OF-PAGE|EOP imperative-statement-2 ]
       ~~~    ~~~~~~~~~~~ ~~~
     [ INVALID KEY imperative-statement-3 ]
       ~~~~~~~
     [ NOT INVALID KEY imperative-statement-4 ]
       ~~~ ~~~~~~~
[ END-WRITE ]
  ~~~~~~~~~