The formats of all statements and some basic language elements are illustrated using syntax diagrams. Read syntax diagrams from left to right and top to bottom.
The following terminology, symbols, and concepts are used in syntax diagrams.
Appear in uppercase letters, for example, COMMAND or PARM. These words must be entered exactly as shown.
Appear in italicized lowercase letters, for example, parm1 or parm2.
Appear on a main line.
Appear below a main line.
Appear with a left-facing arrow.
Indicate the beginning of a statement.
Indicate the end of a statement.
Indicate a portion of a statement, or that the statement continues in another diagram.
If punctuation marks or arithmetic symbols are shown with a keyword or variable, they must be entered as part of the statement or command. Punctuation marks and arithmetic symbols can include:
|
, |
comma |
> |
greater than symbol |
|
. |
period |
< |
less than symbol |
|
( |
open parenthesis |
= |
equal sign |
|
) |
close parenthesis |
¬ |
not sign |
|
+ |
addition |
- |
subtraction |
|
* |
multiplication |
/ |
division |
The following is an example of a statement without parameters.
►►─ COMMAND ──────────────────────────────────────────────────────────────────►◄
You must write:
COMMAND
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.
►►─ COMMAND ─ PARM1 ─ PARM2 ──────────────────────────────────────────────────►◄
You must write:
COMMAND PARM1 PARM2
Delimiters such as parentheses around parameters or clauses must be included.
►►─ COMMAND ─ (PARM1) ─ PARM2='variable' ─────────────────────────────────────►◄
You must write:
COMMAND (PARM1) PARM2='variable'
Where you see a vertical list of parameters as shown in the following example, you must choose one of the parameters. This indicates that only one is required and only one of the displayed parameters is allowed in the statement.
►►─ COMMAND ─┬─ CLAUSE1 ─┬────────────────────────────────────────────────────►◄ ├─ CLAUSE2 ─┤ └─ CLAUSE3 ─┘
You can choose any of the parameters from the vertical list as shown in the following examples.
COMMAND CLAUSE1 COMMAND CLAUSE2 COMMAND CLAUSE3
A single optional parameter appears below the horizontal line that marks the main path.
►►─ COMMAND ─┬─────────────┬──────────────────────────────────────────────────►◄ └─ PARAMETER ─┘
You may or may not use the optional parameter as shown in the following examples:
COMMAND COMMAND PARAMETER
If you have a choice of more than one optional parameter, the parameters appear in a vertical list below the main path.
►►─ COMMAND ─┬───────────┬────────────────────────────────────────────────────►◄ ├─ CLAUSE1 ─┤ └─ CLAUSE2 ─┘
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 CLAUSE1 COMMAND CLAUSE2
For some statements, you can specify more than one parameter, or a single parameter more than once. A repeat symbol (a backward-pointing arrow above the main horizontal line) indicates that you can specify multiple parameters. Below are examples which include the repeat symbol.
┌─────────────┐ ►►─ COMMAND ─▼─ parameter ─┴──────────────────────────────────────────────────►◄
In the preceding example, the word "parameter" is in lowercase italics, indicating that it is a variable, but it is also on the main path, which means that at least one parameter is required. The repeat symbol indicates that you can specify more than one parameter. Assume that you have three values named PARM-X, PARM-Y, and PARM-Z for the variable. Some of your choices can be:
COMMAND PARM-X COMMAND PARM-X PARM-Y COMMAND PARM-Y PARM-Z COMMAND PARM-X PARM-Y PARM-Z
If the repeat symbol contains punctuation such as a comma, you must separate multiple parameters with the punctuation. The following example includes the repeat symbol, a comma, and parentheses.
┌─ , ──────┐ ►►─ COMMAND ─ ( ─▼─ clause ─┴─ ) ─────────────────────────────────────────────►◄
In the preceding example, the word "clause" is in lowercase italics, indicating that it is a variable, but it is also on the main path, which means that at least one clause is required. The repeat symbol indicates that you can specify more than one clause and that you must separate the clauses with commas. The parentheses indicate that the clauses must be enclosed within parentheses. Assume that you have three values named CLAUSE-X, CLAUSE-Y, and CLAUSE-Z for the variable. Some of your choices can be:
COMMAND (CLAUSE-X) COMMAND (CLAUSE-X,CLAUSE-Y) COMMAND (CLAUSE-Y,CLAUSE-Z) COMMAND (CLAUSE-X,CLAUSE-Y,CLAUSE-Z)
The following example shows a vertical list of parameters with the repeat symbol.
┌─────────────┐ ►►─ COMMAND ─▼─┬─ PARM1 ─┬─┴──────────────────────────────────────────────────►◄ ├─ PARM2 ─┤ └─ PARM3 ─┘
Some choices you can make include:
COMMAND PARM2 COMMAND PARM1 PARM2 PARM3 COMMAND PARM3 PARM2 PARM1
The following example shows a vertical list of parameters with a repeat symbol which includes a comma.
┌─ , ─────────┐ ►►─ COMMAND ─▼─┬─ PARM1 ─┬─┴──────────────────────────────────────────────────►◄ ├─ PARM2 ─┤ └─ PARM3 ─┘
Some choices you can make include:
COMMAND PARM2 COMMAND PARM1,PARM2,PARM3 COMMAND PARM3,PARM2,PARM1
When a parameter in a syntax diagram has a left-facing arrow, for example, YES in the following diagram, its special treatment indicates it is the default parameter. If you do not include the default parameter when you write the statement, the result is the same as if you had actually included the parameter.
►►─ COMMAND ─┬──────────────────────┬─────────────────────────────────────────►◄ ├─ PARM1= ─┬─────────┬─┤ │ ├─ YES ◄ ─┤ │ │ └─ NO ────┘ │ └─ CLAUSE2 ────────────┘
Because YES is the default in the preceding example, if you write:
COMMAND CLAUSE2
You have written the equivalent of:
COMMAND PARM1=YES CLAUSE2
In some syntax diagrams, a set of several parameters is represented by a single reference, as shown in the following example.
►►─ COMMAND ─┬─────────────────────┬──────────────────────────────────────────►◄ ├─ CLAUSE1 ───────────┤ └─┤ parameter-block ├─┘
Expansion of parameter-block
├──┬─────────────────────┬─────────────────────────────────────────────────────┤ ├─ PARM1 ─────────────┤ └─ PARM2 ─┬─────────┬─┘ ├─ PARM3 ─┤ └─ PARM4 ─┘
The parameter-block variable can have its own syntax diagram.
Choices you can make from this syntax diagram therefore include (but are not limited to) the following:
COMMAND CLAUSE1 COMMAND PARM1 COMMAND PARM2 PARM4
A note in a syntax diagram is similar to a footnote except that the note appears at the bottom of the diagram box.
►►─ COMMAND ─┬────────────┬───────────────────────────────────────────────────►◄ └─ CLAUSE1¹ ─┘
¹ This is a note about the keyword.
|
Copyright © 2011 CA.
All rights reserved.
|
|