Delimiters and operators are used to separate identifiers and constants. Table 5 shows delimiters and Table 6 shows operators.
| 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 quotes, unmatched parentheses, unmatched comment
delimiters, and missing semicolons. |
||
|
Operator type |
Character(s) |
Description |
|---|---|---|
|
Arithmetic |
+ - * / ** |
Addition or prefix plus Subtraction or prefix minus Multiplication Division Exponentiation |
|
= ¬= < ¬< > ¬> <= >= |
Equal to 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).
Some examples are:
| 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. Use the following syntax when for comments.
|
A comment can be entered on one or more lines, for example:
A = /* This comment is on one line */ 21;
/* This comment spans
two lines */
In the following example, what appears to be a comment is actually a character string constant because it is enclosed in quotes.
A = '/* This is a constant, not a comment */' ;