Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
Procedure Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
6-44
IF Statement
•
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 statements within IF statements are considered as paired IF and ELSE statements,
proceeding from left to right. An ELSE is assumed to apply to the immediately
preceding IF that has not already been paired with an ELSE.
The following conventions apply to the IF statement:
•
If condition is true, statement-1 is executed; if NEXT SENTENCE has
been substituted for statement-1, no operation is performed.
•
If condition is false, statement-2 is executed; if NEXT SENTENCE has
been substituted for statement-2 or if the ELSE clause has been omitted, no
operation is performed.
•
If a GO TO statement that causes a transfer of control is executed as part of
statement-1 or statement-2, control is unconditionally transferred to the
target of the GO TO statement.
•
If control is not unconditionally transferred by execution of a GO TO statement as
part of statement-1 or statement-2, control passes to the next executable
statement following the IF statement after all statements executed as part of the IF
statement have completed.
•
Comparisons (using GREATER THAN, LESS THAN, EQUAL, and so on) of a
PIC N data item or literal with a numeric data item (PIC 9) are not allowed. All
other comparisons are allowed and are done on a byte-by-byte basis.
IF condition { statement-1 } [ ELSE { statement-2 } ]
{ NEXT SENTENCE } [ { NEXT SENTENCE } ]