VOOZH about

URL: https://www.geeksforgeeks.org/cobol/cobol-continue-statement/

⇱ COBOL - Continue Statement - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

COBOL - Continue Statement

Last Updated : 24 Mar, 2022

In simple terms think of the continue statement as a Gatekeeper who will open the gate for the people to come inside the premise to do their task. Similarly continue statement also transfers the control on the next COBOL statement for execution.

Syntax:

CONTINUE

Let's take the example of Continue in Cobol for a better understanding of the concept.

Example:

Explanation:

There are 2 scenarios that will happen in the code, which will be governed by the statement IF WALLET - COST >= 0   CONTINUE meaning if the value in the wallet is greater than equal to the purchase it will make a successful transaction and deduct the money from the wallet and if the balance in the wallet is not enough it will exit with return code 16 and message ''INSUFFICIENT BALANCE'.

Case 1: Person adds enough money to wallet and makes a purchase.

Output:

👁 Image
Money  deducted

In the above example, you can see how the Continue statement moved the flow to make the transaction happen and update the value inside Variable WALLET and the program ends with return code 0.

Case 2: Person doesn't add enough money to wallet and make a purchase 

Output:

👁 Image
Money not deducted

In this case, the program didn't go through the transaction phase and ended with return code 16 and the message 'INSUFFICIENT BALANCE'.

Comment