Skip to main content
eLearner.app

End of the COBOL Course

Summary and final challenge

Congratulations: you have made it through the 4 modules of the COBOL Course — from the fixed layout structure and mandatory divisions, to declaring variables with PICTURE and VALUE, up to formal arithmetic, conditional blocks, modular paragraphs with PERFORM, and finally managing complex data structures such as records and tables with the OCCURS clause. Put your skills to the test with the final challenge.

Reminder: COBOL exercises are verified statically (keywords). To actually run the code, each exercise provides a OneCompiler button that copies the code and opens the sandbox.

01 · Structure and Divisions

  • IDENTIFICATION
  • ENVIRONMENT
  • DATA
  • PROCEDURE
  • WORKING-STORAGE
  • PICTURE
  • VALUE

02 · Operations and Conditionals

  • ADD
  • SUBTRACT
  • MULTIPLY
  • DIVIDE
  • COMPUTE
  • IF / ELSE
  • EVALUATE

03 · Modularity and Iterations

  • paragraphs
  • PERFORM
  • PERFORM TIMES
  • PERFORM UNTIL

04 · Data Structures and Tables

  • 01 / 05 level
  • group items
  • OCCURS clause
  • 1-based tables
  • group MOVE
  • PERFORM UNTIL

The final challenge, in three steps

Complete the COBOL code snippets to declare a numeric variable, perform an arithmetic calculation, and make a repeated paragraph call.

1 · Data declaration in WORKING-STORAGE

Declare a numeric variable suitable for a percentage with one integer digit and two decimal places, initialized to 0.05. Module 1 (structure and variables).

Exercise#cobol.boss.e1
Attempts: 0Loading…

Inside the WORKING-STORAGE SECTION, declare a level-01 variable named WS-INTEREST-RATE, with PICTURE "9V99" and initial value "0.05".

Loading editor…
Show hint

Use the correct format: "01 WS-INTEREST-RATE PIC 9V99 VALUE 0.05." (always terminate COBOL statements with a period).

Solution available after 3 attempts

2 · Arithmetic calculation with COMPUTE

Calculate the interest amount by multiplying the balance by the interest rate. Module 2 (arithmetic and computation).

Exercise#cobol.boss.e2
Attempts: 0Loading…

Write the COMPUTE statement to calculate the value of WS-INTEREST-AMOUNT by multiplying WS-BALANCE by WS-INTEREST-RATE.

Loading editor…
Show hint

Use the syntax: "COMPUTE WS-INTEREST-AMOUNT = WS-BALANCE * WS-INTEREST-RATE."

Solution available after 3 attempts

3 · Repeated call to a paragraph

Repeatedly invoke the paragraph that applies interests to simulate interest accumulation over 5 years. Module 3 (paragraphs and loops).

Exercise#cobol.boss.e3
Attempts: 0Loading…

Inside the PROCEDURE DIVISION, invoke the CALCULATE-INTEREST paragraph exactly 5 times using the PERFORM statement.

Loading editor…
Show hint

Use: "PERFORM CALCULATE-INTEREST 5 TIMES." or the TIMES clause.

Solution available after 3 attempts

Printable Cheatsheet

A single page with all the essential syntax of COBOL, ready to keep handy while you code.

Open the cheatsheet

What now?

Consistent practice is the best way to strengthen your skills. Open the COBOL Playground to experiment freely with complex scenarios or to prepare your code snippets before testing them on OneCompiler.