メインコンテンツにスキップ

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).

運動#cobol.boss.e1
試行回数: 0読み込み中…

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

エディターを読み込み中…
ヒントを表示

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

3 回の試行後に解決策が利用可能になります

2 · Arithmetic calculation with COMPUTE

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

運動#cobol.boss.e2
試行回数: 0読み込み中…

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

エディターを読み込み中…
ヒントを表示

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

3 回の試行後に解決策が利用可能になります

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).

運動#cobol.boss.e3
試行回数: 0読み込み中…

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

エディターを読み込み中…
ヒントを表示

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

3 回の試行後に解決策が利用可能になります

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.