Reading Syntax Diagrams
Throughout this book, syntax is described using the structure defined below.
- Read the syntax diagrams from left to right, and from top to bottom, following
the path of the line:
- >>---
- Indicates the beginning
of a statement. Diagrams of syntactical units other than statements, such
as clauses, phrases and paragraphs, also start with this symbol.
- --->
- Indicates that the statement syntax is continued on the next line.
- >----
- Indicates that a statement is continued from the previous line.
- ---><
- Indicates the end of a statement. Diagrams of syntactical units other
than statements, such as clauses, phrases and paragraphs, also end with this
symbol.
Note:
Statements within a diagram of an entire paragraph do
not start with >>--- and end with ---><
unless their beginning or ending coincides with that of the paragraph.
- Required items appear on
the horizontal line (the main path). Optional items appear below the main
path:

>>-STATEMENT--required item--+---------------+-----------------><
'-optional 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. If choosing an item is optional, the entire stack appears
below the main path:

>>-STATEMENT--+-required-choice-1-+--+-------------------+-----><
'-required-choice-2-' +-optional-choice-1-+
'-optional-choice-2-'
- An arrow returning to the left above an item indicates that the item can
be repeated:

.-----------------.
V |
>>-STATEMENT----repeatable-item-+------------------------------><
- A repeat arrow above a stack of required or optional choices indicates
that you can make more than one choice from the stacked items, or repeat a
single choice:

.--------------. .--------------.
V | V |
>>-STATEMENT----+-choice-1-+-+----+----------+-+---------------><
'-choice-2-' +-choice-3-+
'-choice-4-'
The following example shows how the syntax is used:

Format
(1) (2)
>>-STATEMENT-------+-identifier-1------+------------------------>
'-literal-1---------'
.---------------------.
V |
>----+-----------------+-+-------------------------------------->
| (3) |
'-| item 1 |------'
.------------------------------------.
V (4) |
>----TO--identifier-m--+---------+------+----------------------->
'-ROUNDED-'
(5)
>--+--------------------------------------------+--------------->
'-+----+--SIZE ERROR--imperative-statement-m-'
'-ON-'
(6)
>--+---------------+-------------------------------------------><
'-END-STATEMENT-'
item 1:
|--+-identifier-2------------+----------------------------------|
+-literal-2---------------+
'-arithmetic-expression-1-'
Notes:
- The STATEMENT key word must be specified and coded as
shown.
- This operand is required. Either identifier-1 or literal-1
must be coded.
- 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.
- The operand identifier-m and associated TO key word are
required and can be repeated with one or more COBOL separators separating
each entry. Each entry can be assigned the key word ROUNDED.
- The ON SIZE ERROR phrase with associated imperative-statement-m
are optional. If the ON SIZE ERROR phrase is coded, the key word ON is optional.
- The END-STATEMENT key word can be coded to end the statement.
It is not a required delimiter.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.