Delimiters and operators are used to separate identifiers and constants.
Table 1 shows delimiters.
Name | Delimiter | Use |
---|---|---|
Comma | , | Separates elements of a list; precedes the BY NAME option |
Period | . | Connects elements of a qualified name; decimal or binary point |
Semicolon | ; | Terminates a statement |
Equal sign | = | Indicates assignment or, in a conditional expression, equality |
Colon | : | Connects prefixes to statements; connects lower-bound to upper-bound in a dimension attribute; used in RANGE specification of DEFAULT statement |
Blank | b | Separates elements |
Parentheses | ( ) | Enclose lists, expressions, iteration factors, and repetition factors; enclose information associated with various keywords |
Locator | –> | Denotes locator qualification (pointers and offsets) |
=> | Denotes locator qualification (handles) | |
Percent | % | Indicates %statements and %directives |
Note: Omitting certain
symbols can cause errors that are difficult to trace. Common errors
are unbalanced quotation marks, unmatched parentheses, unmatched comment
delimiters, and missing semicolons.
|
Table 2 shows operators.
Operator type | Character(s) | Description |
---|---|---|
Arithmetic | + | Addition or prefix plus |
- | Subtraction or prefix minus | |
* | Multiplication | |
⁄ | Division | |
** | Exponentiation | |
Comparison | = | Equal to |
¬= or <> | Not equal to | |
< | Less than | |
¬< | Not less than | |
> | Greater than | |
¬> | Not greater than | |
<= | Less than or equal to | |
>= | Greater than or equal to | |
Logical | ¬ | Not, Exclusive-or |
& | And | |
| | Or | |
String | ∥ | Concatenation |
The characters used for delimiters can be used in other contexts. For example, the period is a delimiter when used in name qualification (for example, Weather.Temperature), but is a decimal point in an arithmetic constant (for example, 3.14).
You can surround each operator or delimiter with blanks (b).
One or more blanks must separate identifiers and constants that are not separated by some other delimiter. The only exception to this rule is that the identifiers P, PIC and PICTURE can be followed by a character string without any intervening blanks. Any number of blanks can appear wherever one blank is allowed.
Blanks cannot occur within identifiers, composite symbols, or constants (except in character, mixed, widechar and graphic string constants). See the following examples.
ab+bc | is equivalent to | Ab + Bc |
Table(10) | is equivalent to | TABLEb(b10bbb) |
First,Second | is equivalent to | first,bsecond |
AtoB | is not equivalent to | AbtobB |
Other cases that require or allow blanks are noted where those language features are discussed.
Comments are allowed wherever blanks are allowed as delimiters. A comment is treated as a blank and used as a delimiter. Comments are ignored and do not affect the logic of a program.
A = /* This comment is on one line */ 21;
/* This comment spans
two lines */
A = 21 ; // This comment ends with the end of this line
A = '/* This is a constant, not a comment */' ;
Comments cannot be nested. However, the %DO SKIP: statement can be used as a way of "commenting out" code that contains comments.