Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
SCREEN COBOL Source Program
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
2-14
Arithmetic Operators
Data items and literals appearing in an arithmetic expression must be either numeric
elementary items or numeric literals on which arithmetic operations can be performed.
Any arithmetic expression can be preceded by a plus or minus sign.
Arithmetic Operators
Five binary arithmetic operators and two unary arithmetic operators are used in
arithmetic expressions. These operators are represented by specific characters and must
be preceded and followed by a space. Table 2-6
lists binary arithmetic operators.
Table 2-7 lists unary arithmetic operators.
When a plus or minus sign immediately precedes a numeric literal (with no intervening
spaces) the sign becomes a part of that literal, making it a signed numeric literal. The
sign is neither a binary or unary operator. For example,
X +2
is equivalent to:
X, +2
which is two separate expressions.
A plus sign in any other situation is treated as a binary operator if it is preceded by an
operand, and treated as a unary operator if it is not preceded by an operand. For
example, the following are equivalent expressions:
X + 2
X + + 2
Table 2-6. Binary Arithmetic Operators
+ Addition
- Subtraction
* Multiplication
/ Division
** Exponentiation
Table 2-7. Unary Arithmetic Operators
+ The effect of multiplying by +1
- The effect of multiplying by -1