مرکزی مواد پر جائیں

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.