COBOL Manual for TNS/E Programs (H06.03+)

Procedure Division
HP COBOL Manual for TNS/E Programs520347-003
8-63
Simple Conditions
Sign Conditions
The sign condition determines whether the algebraic value of an arithmetic expression
is less than, greater than, or equal to zero.
arithmetic-expression
is an arithmetic expression, as described in Arithmetic Expressions
.
Usage Considerations:
NOT Modifier
When NOT appears, it and the next keyword are considered to form a single sign
condition. For example, NOT ZERO is a truth test that determines if the operand
value is nonzero (is positive or negative).
Definition
An operand is positive if its value is greater than zero, negative if its value is less
than zero, and zero if its value is equal to zero.
Example 8-13. External Switches
SPECIAL-NAMES.
SWITCH-1 IS IN-SWITCH ON STATUS IS TAPE-INPUT
OFF STATUS IS DISK-INPUT
SWITCH-2 IS OUT-SWITCH ON STATUS IS TAPE-OUTPUT
OFF STATUS IS DISK-OUTPUT.
...
PROCEDURE DIVISION.
...
IF TAPE-INPUT OPEN INPUT TAPE-SOURCE
ELSE OPEN INPUT DISK-SOURCE.
IF TAPE-OUTPUT OPEN OUTPUT TAPE-SINK
ELSE OPEN OUTPUT DISK-SINK.
...
arithmetic-expression
POSITIVE
NEGATIVE
ZERO
IS NOT
VST121.vsd