CONTINUE Statement


  • CONTINUE statement transfers the control to the immediate statement that comes next in the program flow.
  • It is a no-operation, and it is a do-nothing statement.
  • It serves no functional purpose in terms of processing logic.

Syntax -

CONTINUE

Points to Note -

  • CONTINUE is allowed to code only in conditional statements like IF, IF...ELSE and EVALAUTE.
  • It satisfies syntactic requirements or improves code readability.

Practical Example -


Scenario - Add 2000 to salary if it is less than 5000.

Input - 6000

Code -

----+----1----+----2----+----3----+----4----+----5----+
       ...
       WORKING-STORAGE SECTION. 
       01 WS-VAR.
          05 WS-SALARY         PIC 9(04).
       ...
       PROCEDURE DIVISION.
      * Accepting Salary amount from input
           ACCEPT WS-SALARY.
      * Salary is greater than 5000, do nothing
           IF WS-SALARY GREATER THAN 5000
              CONTINUE
           ELSE
              COMPUTE WS-SALARY = WS-SALARY + 2000
           END-IF.
      * Displaying Salary
           DISPLAY "SALARY: " WS-SALARY. 
           ...

Run JCL -

//MATESYD JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID
//*
//STEP01  EXEC PGM=CONTINST
//STEPLIB  DD  DSN=MATESY.COBOL.LOADLIB,DISP=SHR 
//SYSOUT   DD  SYSOUT=*
//SYSIN    DD  *
6000
/*

Output -

SALARY: 6000