Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)
Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual—426750-003
6-70
IF Statement
procedure-name
is a series of procedure names. Only one is chosen, based on the value of
depend
.
depend
is the identifier of an elementary numeric integer data item. This item acts like an
index because its value selects the procedure name to which the program
branches. If the value of
depend
is outside the range of
procedure-name
, no
branching occurs and control passes to the next statement.
The following example illustrates the GO TO DEPENDING statement:
procedure-branch.
GO TO proc-1,
proc-2,
proc-3, DEPENDING ON branch-flag.
MOVE 0 to branch-flag.
•
If branch-flag is 1, control passes to proc-1.
•
If branch-flag is 2, control passes to proc-2.
•
If branch-flag is 3, control passes to proc-3.
•
If branch-flag is less than 1 or greater than 3, control passes to the statement
immediately following the GO TO DEPENDING statement.
IF Statement
The IF statement evaluates a condition and then transfers control depending on
whether the value of the condition is true or false.
condition
is any conditional expression.
statement-1
,
statement-2
are imperative or conditional statements. Each statement can contain an IF
statement, in which case the statement is referred to as a nested IF statement.
NEXT SENTENCE
is a substitution for
statement-1
or
statement-2
. The phrase performs no
operation, but is used to preserve the syntactical structure or to emphasize that
one value of condition elicits no action.
IF
condition
{
statement-1
} [ ELSE {
statement-2
} ]
{ NEXT SENTENCE } [ { NEXT SENTENCE } ]










