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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-74
IF
depend
is the identifier of an elementary integer data item. Its value determines which
procedure will receive control. If the value of depend is less than 1 or exceeds the
number of procedures, control passes to the next statement.
Usage Considerations:
Declarative and Nondeclarative Procedures
A GO TO statement in a declarative procedure (a procedure in the Declaratives
Portion of the Procedure Division) cannot refer to a nondeclarative procedure (a
procedure in the other portion of the Procedure Division). A GO TO statement in a
nondeclarative procedure cannot refer to a declarative procedure.
Debugging Declarative Procedures
A GO TO statement in a debugging declarative procedure cannot refer to a
nondebugging declarative procedure. A GO TO statement in a nondebugging
declarative procedure cannot refer to a debugging declarative procedure.
In Example 9-24, if BRANCH-FLAG equals 1, control passes to PROC-X. If
BRANCH-FLAG equals 2, control passes to PROC-Y. If BRANCH-FLAG equals 3,
control passes to PROC-Z. If BRANCH-FLAG is less than 1 or greater than 3,
control passes to the MOVE statement immediately following the GO TO
statement.
IF
IF transfers control if the value of a condition is TRUE or FALSE.
Example 9-24. Three-Way Conditional GO TO Statement
PROCEDURE-BRANCH.
GO TO PROC-X
PROC-Y
PROC-Z DEPENDING ON BRANCH-FLAG
MOVE 0 TO BRANCH-FLAG
Form Comment
Delimited-Scope Form
Recommended for clarity and convenience
Conditional Form
Form that was available in COBOL 74