Reading Syntax Diagrams

Syntax diagrams are used to illustrate the format of statements and some basic language elements. Read syntax diagrams from left to right and top to bottom.
datacom151
Syntax diagrams are used to illustrate the format of statements and some basic language elements. Read syntax diagrams from left to right and top to bottom.
The following terminology, symbols, and concepts are used in syntax diagrams:
  • Keywords appear in uppercase letters, for example, COMMAND or PARM. These words must be entered exactly as shown.
  • Variables appear in italicized lowercase letters, for example,
    variable
    .
  • Required keywords and variables appear on a main line.
  • Optional keywords and variables appear below a main line.
  • Default keywords and variables appear above a main line.
  • Double arrowheads pointing to the right indicate the beginning of a statement.
  • Double arrowheads pointing to each other indicate the end of a statement.
  • Single arrowheads pointing to the right indicate a portion of a statement, or that the statement continues in another diagram.
  • Punctuation marks or arithmetic symbols that are shown with a keyword or variable must be entered as part of the statement or command. Punctuation marks and arithmetic symbols can include the following:
,
comma
>
greater than symbol
.
period
<-
less than symbol
(
open parenthesis
=
equal sign
)
close parenthesis
¬
not sign
+
addition
-
subtraction
*
multiplication
/
division
The following topics are discussed on this page:
Statement Without Parameters
The following is a diagram of a statement without parameters:
►►─ COMMAND ────────────────────────────────────────────────────────►◄
For this statement, you must write the following:
COMMAND
Statement with Required Parameters
Required parameters appear on the same horizontal line, the main path of the diagram, as the command or statement. The parameters must be separated by one or more blanks.
The following is a diagram of a statement with required parameters:
►►─ COMMAND ─ PARM1 ─ PARM2 ────────────────────────────────────────►◄
You must write the following:
COMMAND PARM1 PARM2
Delimiters Around Parameters
Delimiters, such as parentheses, around parameters or clauses must be included.
The following is a diagram of a statement with delimiters around parameters:
►►─ COMMAND ─ (PARM1) ─ PARM2='
variable
' ───────────────────────────►◄
If the word
variable
is a valid entry, you must write the following:
COMMAND (PARM1) PARM2='variable'
Choice of Required Parameters
When you see a vertical list of parameters as shown in the following example, you must choose one of the parameters. This indicates that one entry is required, and only one of the displayed parameters is allowed in the statement.
The following is a diagram of a statement with a choice of required parameters:
►►─ COMMAND ─┬─ PARM1 ─┬────────────────────────────────────────────►◄ ├─ PARM2 ─┤ └─ PARM3 ─┘
You can choose one of the parameters from the vertical list, such as in the following examples:
COMMAND PARM1 COMMAND PARM2 COMMAND PARM3
Default Value for a Required Parameter
When a required parameter in a syntax diagram has a default value, the default value appears above the main line, and it indicates the value for the parameter if the command is not specified. If you specify the command, you must code the parameter and specify one of the displayed values.
The following is a diagram of a statement with a default value for a required parameter:
►►─ COMMAND ─ PARM1= ─┬─ YES ◄ ─┬─ PARM2 ────────────────────────────►◄ └─ NO ────┘
If you specify the command, you must write one of the following:
COMMAND PARM1=NO PARM2 COMMAND PARM1=YES PARM2
Optional Parameter
A single optional parameter appears below the horizontal line that marks the main path.
The following is a diagram of a statement with an optional parameter:
►►─ COMMAND ─┬─────────────┬────────────────────────────────────────►◄ └─ PARAMETER ─┘
You can choose (or not) to use the optional parameter, as shown in the following examples:
COMMAND COMMAND PARAMETER
Choice of Optional Parameters
If you have a choice of more than one optional parameter, the parameters appear in a vertical list below the main path.
The following is a diagram of a statement with a choice of optional parameters:
►►─ COMMAND ─┬─────────┬────────────────────────────────────────────►◄ ├─ PARM1 ─┤ └─ PARM2 ─┘
You can choose any of the parameters from the vertical list, or you can write the statement without an optional parameter, such as in the following examples:
COMMAND COMMAND PARM1 COMMAND PARM2
Repeatable Variable Parameter
In some statements, you can specify a single parameter more than once. A repeat symbol indicates that you can specify multiple parameters.
The following is a diagram of a statement with a repeatable variable parameter:
┌────────────┐ ►►─ COMMAND ─▼─
variable
─┴─────────────────────────────────────────►◄
In the preceding diagram, the word
variable
is in lowercase italics, indicating that it is a value you supply, but it is also on the main path, which means that you are required to specify at least one entry. The repeat symbol indicates that you can specify a parameter more than once. Assume that you have three values named VALUEX, VALUEY, and VALUEZ for the variable. The following are some of the statements you might write:
COMMAND VALUEX COMMAND VALUEX VALUEY COMMAND VALUEX VALUEX VALUEZ
Separator with Repeatable Variable and Delimiter
If the repeat symbol contains punctuation such as a comma, you must separate multiple parameters with the punctuation. The following diagram includes the repeat symbol, a comma, and parentheses:
The following is a diagram of a statement with a separator with a repeatable variable and a delimiter:
┌─ , ────────┐ ►►─ COMMAND ─ ( ─▼─
variable
─┴─ ) ─────────────────────────────────►◄
In the preceding diagram, the word
variable
is in lowercase italics, indicating that it is a value you supply. It is also on the main path, which means that you must specify at least one entry. The repeat symbol indicates that you can specify more than one variable and that you must separate the entries with commas. The parentheses indicate that the group of entries must be enclosed within parentheses. Assume that you have three values named VALUEA, VALUEB, and VALUEC for the variable.
The following are some of the statements you can write:
COMMAND (VALUEC) COMMAND (VALUEB,VALUEC) COMMAND (VALUEB,VALUEA) COMMAND (VALUEA,VALUEB,VALUEC)
Optional Repeatable Parameters
The following diagram shows a list of parameters with the repeat symbol for optional repeatable parameters:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ►►─ COMMAND ─▼─┬─────────┬─┴─▼─┬─────────┬─┴─▼─┬─────────┬─┴────────►◄ └─ PARM1 ─┘ └─ PARM2 ─┘ └─ PARM3 ─┘
The following are some of the statements you can write:
COMMAND PARM1 COMMAND PARM1 PARM2 PARM3 COMMAND PARM1 PARM1 PARM3
Default Value for a Parameter
The placement of YES in the following diagram indicates that it is the default value for the parameter. If you do not include the parameter when you write the statement, the result is the same as if you had actually specified the parameter with the default value.
The following is a diagram of a statement with a default value for an optional parameter:
►►─ COMMAND ─┬──────────────────────┬─ PARM2 ───────────────────────►◄ └─ PARM1= ─┬─ YES ◄ ─┬─┘ └─ NO ────┘
For this command, COMMAND PARM2 is the equivalent of COMMAND PARM1=YES PARM2.
Variables Representing Several Parameters
In some syntax diagrams, a set of several parameters is represented by a single reference.
The following is a diagram of a statement with variables representing several parameters:
►►─ COMMAND ─┬─────────────────────┬────────────────────────────────►◄ ├─ PARM1 ─────────────┤ └─┤ parameter-block ├─┘
Expansion of parameter-block
├──┬─────────────────────┬───────────────────────────────────────────┤ ├─ PARM2 ─────────────┤ └─ PARM3 ─┬─────────┬─┘ ├─ PARM4 ─┤ └─ PARM5 ─┘
The
parameter-block
can be displayed in a separate syntax diagram.
Choices you can make from this syntax diagram therefore include, but are not limited to, the following:
COMMAND PARM1 COMMAND PARM3 COMMAND PARM3 PARM4
Before you can specify PARM4 or PARM5 in this command, you must specify PARM3.