IF condition1 statementblock [ELSE-IF|ELSE IF condition1 statementblock . . . ELSE-IF|ELSE IF conditionN statementblock ] [ELSE statementblock ]
COBOLimperativestatement ... COBOLconditionalclause statementblock ELSE-IF|ELSE IF condition1 statementblock [ . . . ELSE-IF|ELSE IF conditionN statementblock ] [ELSE statementblock ]
ADD, RETURN, CALL, REWRITE, COMPUTE, START, DELETE, STRING, DIVIDE, SUBTRACT, MULTIPLY, UNSTRING, READ, WRITE.
If line 2020 is false, pass control back to line 1020, the first statement after the PERFORM statement, because there is no ELSE-IF or ELSE coding associated with this IF, and the first character at the same or less indentation as this IF is a new paragraph name, which denotes the end of the preceding PERFORMed paragraph. If the line 2020 condition is true, execute its subordinate statement block (lines 2030 through 2170) and return control to line 1020.
001010 PERFORM EMPLOYEE-BENEFIT-DEDUCTION 001020 MOVE ... . . 002010 PARA EMPLOYEE-BENEFIT-DEDUCTION 002020 IF EMPL-COVERAGE NOT = SPACES 002030 PERFORM CALC-BASIC-BEN 002040 IF EMPL-COVERAGE-TYPE = 'EXTRA' 002050 PERFORM CALC-EXTRA-BEN 002060 PERFORM CALC-DENTAL-BEN 002070 BEN-FIELD = XTRA-BEN + 002071 ... DENTAL-BEN 002080 ELSE-IF EMPL-COVERAGE-TYPE = 002081 ... 'FAMILY' 002090 PERFORM CALC-FAMILY-BEN 002100 PERFORM CALC-DENTAL-BEN 002110 BEN-FIELD = FAMILY-BEN + 002111 ... DENTAL-BEN 002120 ELSE-IF EMPL-COVERAGE-TYPE = 002121 ... 'DENTAL' 002130 PERFORM CALC-DENTAL-BEN 002140 BEN-FIELD = BASIC-BEN + 002141 ... DENTAL-BEN 002150 ELSE 002160 BEN-FIELD = BASIC-BEN 002170 EMPL-DED-FIELD = 002171 ... BEN-FIELD * .5 / 12 002180 002190 PARA CALC-BASIC-BEN
IF condition1 statementblock1 IF condition2 IF condition3 statementblock2 ELSE-IF condition4 ELSE-IF condition5 statementblock3 ELSE statementblock4 ELSE statementblock5 IF condition6 IF condition7 statementblock6 statementblock7
WS-NET-PAY = EMP-HOURS * ... EMP-HOURLY-RATE ... ON SIZE ERROR PERFORM PRINT-ERROR-MESSAGE DISPLAY SSNO WS-NET-PAY WS-NET-PAY WS-DEDUC = 0 ELSE-IF EMP-HOURLY-RATE = MIN-WAGE PERFORM CALC-DEDUC-MIN ELSE-IF EMP-HOURLY-RATE < 5.00 PERFORM CALC-DEDUC-1 ELSE-IF EMP-HOURLY-RATE >= 5.00 PERFORM CALC-DEDUC-2 IF EMP-HOURLY-RATE > 20.00 DISPLAY SSNO ... EMP-HOURLY-RATE ELSE DISPLAY SSNO EMP-HOURLY-RATE PERFORM PRINT-ERROR-MESSAGE NET-PAY = WS-NET-PAY - WS-DEDUC
PARA CALC-BENEFIT BEN-FIELD = ZERO IF PERM-PART-TIME PERFORM GROUP-A-CALC IF HRS-WORKED > 25 BEN-FIELD = ... BEN-FIELD * 1.25 ELSE-IF PART-TIME ELSE-IF FULL-TIME PERFORM GROUP-B-CALC EMPL-REC-BEN-FIELD = ... BEN-FIELD
CALC-BENEFIT. MOVE ZERO TO BEN-FIELD. IF PERM-PART-TIME PERFORM GROUP-A-CALC IF HRS-WORKED > 25 MULTIPLY BEN-FIELD BY 1.25 ELSE NEXT SENTENCE ELSE IF PART-TIME NEXT SENTENCE ELSE IF FULL-TIME PERFORM GROUP-B-CALC ELSE NEXT SENTENCE. MOVE BEN-FIELD TO EMPL-REC-BEN-FIELD.