MODULE 7: COBOL Control statements
CONTINUE statement
- CONTINUE is introduced in COBOL-85
- It is a dummy statement and does no operation. This is mostly used in a conditional statement or an imperative statement to just exit without doing any operation
- CONTINUE is indication that there is no statements to be executed for this path
- CONTINUE just passes control to next immediate statement without doing any operation
- Syntax:-
CONTINUE
- Example:-
In PROCEDURE DIVISION,MOVE 10000 TO EMP-SALARY. IF EMP-GRADE = ‘C’ THEN CONTINUE ELSE ADD 1000 TO EMP-SALARY END-ID DISPLAY ‘NEW SALARY: ‘ EMP-SALARY. DISPLAY ‘EMP-GRADE: ‘ EMP-GRADE.Now, in above example, suppose EMP-GRADE can be either ‘A’, ‘B’ or ‘C’. For employees with EMP-GRADE = ‘C’, no bonus will be given. Thus, when program identifies that employee grade is ‘C’, it does nothing and directly will come out of IF statement and will display NEW-SALARY and his/her grade.SYSOUT display (output) when EMP-GRADE = ‘A’:-NEW-SALARY: 11000 EMP-GRADE: ASYSOUT display (output) when EMP-GRADE = ‘C’:-NEW-SALARY: 10000 EMP-GRADE: C
- Flow diagram to demonstrate code flow of above example:-