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

Procedure Division
HP COBOL Manual for TNS/E Programs520347-003
8-62
Simple Conditions
Usage Considerations:
Condition-Name Conditions
The rules for comparing a conditional variable with the literal values corresponding
to a condition-name are the same as those specified for relation conditions.
The result of the test is TRUE if either of these relations is satisfied:
°
The value of the conditional variable equals one of the single values
corresponding to the condition-name.
°
The value of the conditional variable falls within one of the ranges of values,
including the end values, corresponding to the condition-name.
Switch-Status Conditions
A switch-status condition determines whether an external switch is on or off. The
particular switch and the ON or OFF value associated with the condition must be
named in the SPECIAL-NAMES paragraph of the Environment Division.
Usage Considerations:
TRUE Value
The result of the test is TRUE if the switch is set to the position corresponding to
the one identified by the condition-name; otherwise, the result of the test is FALSE.
Setting External Switches
Set external switch value by using the PARAM command of the command
interpreter (see SPECIAL-NAMES Paragraph) or by the SET statement (see SET).
Example 8-12. Conditional Variables
WORKING-STORAGE SECTION.
01 ZIP-CODE.
03 ZIP-FIRST-3 PICTURE 999.
...
88 NEW-YORK VALUE IS 090 THRU 098,
100 THRU 149.
88 PENNSYLVANIA VALUE IS 150 THRU 196.
...
PROCEDURE DIVISION.
...
ELSE IF NEW-YORK MOVE "NY" TO STATE-FROM-ZIP
ELSE IF PENNSYLVANIA MOVE "PA" TO STATE-FROM-ZIP
...
IF STATE-INPUT NOT = STATE-FROM-ZIP
PERFORM QUERY-ZIP-OR-STATE-CORRECTION.