Control Data Corporation 3300 Reference Manual page 112

Computer systems usasi cobol/ master
Table of Contents

Advertisement

4.7.12
IF
4-32
The IF statement causes a condition to be evaluated; subsequent action of the
object program depends on whether the value is true or false.
. . 1
statement-1
l [
1
statement-2
lJ
IF condItion;
NEXT SENTENCE
~
; ELSE
NEXT SENTENCE
~
Statement-1 and statement-2 represent a conditional statement or an impera-
tive statement; either may be followed by a conditional statement.
The phrase ELSE NEXT SENTENCE may be omitted if it immediately precedes
the terminal period of the sentence.
When an IF statement is executed, the following action is taken:
If
the condition is true, statements immediately following the condition
are executed; control then passes implicitly to the next sentence.
If
the condition is false, either statements following ELSE
(statement-2) are executed, or
if
the ELSE clause is omitted, the
next sentence is executed.
If the words NEXT SENTENCE are written and the condition is met, control
passes explicitly to the next sentence.
Examples:
1.
IF COUNTER IS GREATER THAN 5 GO TO RESET-CNT; ELSE
ADD 1 TO COUNTER GO TO UPDATE-PROC.
2.
IF A IS NUMERIC MULTIPLY A BY B; IF B IS LESS THAN 50
ADD A B TO C ELSE ADD A B TO D ELSE GO TO BADCLASS.
3.
IF PERFORM-COUNT IS POSITIVE; GO TO START; ELSE NEXT
SENTENCE.
4.
DATA DIVISION.
01
PASSING-GRADE.
88
PASS VALUE 75 TO 100.
88
FAIL VALUE 0 TO 75.
PROCEDURE DIVISION.
IF PASS GO TO X.
If
statement-1 and statement-2 contain an IF statement, the IF statement is
said to be nested.
60229400

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 3300 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

3500

Table of Contents