How to read the syntax diagrams

Throughout the document, diagrams illustrate Enterprise COBOLCOBOL for AIX® COBOL for Linuxsyntax.

Use the following description to read the syntax diagrams in this document: Link to How to read dotted decimal syntax diagrams

  • Read the syntax diagrams from left to right, from top to bottom, following the path of the line.

    The ►►─── symbol indicates the beginning of a syntax diagram.

    The ───► symbol indicates that the syntax diagram is continued on the next line.

    The ►─── symbol indicates that the syntax diagram is continued from the previous line.

    The ───►◄ symbol indicates the end of a syntax diagram.

    Diagrams of syntactical units other than complete statements start with the ►─── symbol and end with the ───► symbol.

  • Required items appear on the horizontal line (the main path).

    Format

    Read syntax diagramSkip visual syntax diagramSTATEMENTrequired item
  • Optional items appear below the main path.

    Format

    Read syntax diagramSkip visual syntax diagramSTATEMENToptional item
  • When you can choose from two or more items, they appear vertically, in a stack.

    If you must choose one of the items, one item of the stack appears on the main path.

    Format

    Read syntax diagramSkip visual syntax diagramSTATEMENTrequired choice 1required choice 2

    If choosing one of the items is optional, the entire stack appears below the main path.

    Format

    Read syntax diagramSkip visual syntax diagramSTATEMENToptional choice 1optional choice 2
  • An arrow returning to the left above the main line indicates an item that can be repeated.

    Format

    Read syntax diagramSkip visual syntax diagramSTATEMENTrepeatable item

    A repeat arrow above a stack indicates that you can make more than one choice from the stacked items, or repeat a single choice.

  • Variables appear in italic lowercase letters (for example, parmx). They represent user-supplied names or values.
  • If punctuation marks, parentheses, arithmetic operators, or other such symbols are shown, they must be entered as part of the syntax.

The following example shows how the syntax is used.

Format

Read syntax diagramSkip visual syntax diagramSTATEMENT1 identifier-12literal-1item 13TOidentifier-3ROUNDED4ONSIZE ERRORimperative-statement-15END-STATEMENT6
item 1
Read syntax diagramSkip visual syntax diagramidentifier-2literal-2arithmetic-expression-1
Notes:
  • 1 The STATEMENT keyword must be specified and coded as shown.
  • 2 This operand is required. Either identifier-1 or literal-1 must be coded.
  • 3 The item 1 fragment is optional; it can be coded or not, as required by the application. If item 1 is coded, it can be repeated with each entry separated by one or more COBOL separators. Entry selections allowed for this fragment are described at the bottom of the diagram.
  • 4 The operand identifier-3 and associated TO keyword are required and can be repeated with one or more COBOL separators separating each entry. Each entry can be assigned the keyword ROUNDED.
  • 5 The ON SIZE ERROR phrase with associated imperative-statement-1 is optional. If the ON SIZE ERROR phrase is coded, the keyword ON is optional.
  • 6 The END-STATEMENT keyword can be coded to end the statement. It is not a required delimiter.