01 · Structure, Columns and DATA DIVISION
The four mandatory divisions, the fixed 80 column format (Area A / Area B) and the exact RAM layout of the PIC clauses.
- 4 Divisions
- Col 1–80
- PIC X / 9 / V / S
- VALUE & Padding
End of the COBOL Course
Congratulations! You have completed all 8 modules and 16 lessons of the COBOL course — from the four divisions, fixed-format columns, PIC/VALUE/REDEFINES, and decimal arithmetic through PERFORM loops, OCCURS tables, batch file I/O, STRING/INSPECT, CALL subprograms, SORT, copybooks, and COMP-3 packed decimals.
8 modules · 16 lessons · 80 checkpoints
Every COBOL exercise is checked locally via the deterministic in-browser COBOL subset evaluator (column 72 diagnostics, WORKING-STORAGE state, DISPLAY output, and keywords); for full GNUCOBOL compilation, click Open on OneCompiler in any panel.
The four mandatory divisions, the fixed 80 column format (Area A / Area B) and the exact RAM layout of the PIC clauses.
Formal COBOL arithmetic (ADD, SUBTRACT, MULTIPLY, DIVIDE), COMPUTE expressions, rounding and branching with IF and EVALUATE.
Structure the PROCEDURE DIVISION into reusable paragraphs with PERFORM, avoid accidental fall-throughs, and master TIMES, UNTIL, and VARYING.
Organize data into contiguous group items (01/05/10), MOVE group semantics, and base-1 arrays with OCCURS and SEARCH.
Connect logical and physical files via SELECT ASSIGN / FD and implement safe batch loops with OPEN, priming READ AT END, WRITE and CLOSE.
Fixed text field processing with STRING, UNSTRING and INSPECT and multi-program modular architecture via CALL, LINKAGE SECTION and GOBACK.
High performance pipeline with SORT/MERGE to SD work files, reuse of shared layouts COPY ... REPLACING, REDEFINES and Level 88 condition names.
Binary/BCD representation in mainframe memory (COMP-3, DISPLAY Zoned), exact financial arithmetic, and diagnosis of batch jobs and historical bugs.
Combine real-world mainframe batch idioms across five progressive steps: PIC accounting declaration, COMPUTE interest calculation, PERFORM paragraph iteration, Level-88 condition branching, and STRING key composition with COMP-3 storage.
Allocate `WS-INTEREST-RATE` in `WORKING-STORAGE SECTION` using an implied decimal `V` for banking precision (Module 1).
Declare a numeric data item 01 WS-INTEREST-RATE with PIC 9V99 and initial VALUE 0.05. inside WORKING-STORAGE SECTION..
Write 01 WS-INTEREST-RATE PIC 9V99 VALUE 0.05. starting at column 8 (Area A).
Solution available after 3 attempts
Compute accrued interest by multiplying balance and rate in a single readable `COMPUTE` statement (Module 2).
Write a COMPUTE statement storing WS-BALANCE * WS-INTEREST-RATE into WS-INTEREST-AMOUNT.
Use COMPUTE WS-INTEREST-AMOUNT = WS-BALANCE * WS-INTEREST-RATE. in Area B (Col 12).
Solution available after 3 attempts
Execute a dedicated calculation paragraph five consecutive times without duplicating logic (Module 3).
Invoke the CALCULATE-INTEREST paragraph 5 TIMES using PERFORM.
Write PERFORM CALCULATE-INTEREST 5 TIMES. under MAIN-PROCEDURE..
Solution available after 3 attempts
Model a transaction state using a Level-88 condition name for clean, self-documenting batch checks (Module 4 + Module 7).
Define 88 STATUS-VALID VALUE "V". beneath WS-TX-STATUS and check IF STATUS-VALID DISPLAY "APPROVED" END-IF. in PROCEDURE DIVISION.
Add 88 STATUS-VALID VALUE "V"., then write IF STATUS-VALID, DISPLAY "APPROVED", and close cleanly with END-IF..
Solution available after 3 attempts
Declare a compact packed-decimal `COMP-3` accumulator and assemble a clean batch key via `STRING` (Module 6 + Module 8).
Declare 01 WS-PACKED-BAL PIC S9(7)V99 COMP-3 VALUE 0. and concatenate WS-ACCT (DELIMITED BY SPACE), "-", and WS-YEAR (DELIMITED BY SIZE) INTO WS-RECORD-KEY ending with END-STRING..
Use PIC S9(7)V99 COMP-3 and STRING WS-ACCT DELIMITED BY SPACE "-" DELIMITED BY SIZE WS-YEAR DELIMITED BY SIZE INTO WS-RECORD-KEY END-STRING..
Solution available after 3 attempts
All essential COBOL syntax on one printable page: divisions, 80-column ruler, PIC, REDEFINES, Level 88, OCCURS/SEARCH, File I/O, STRING/CALL, and COMP-3.
Practice immediately inside the COBOL Playground with instant in-browser simulation, or run full batch programs in GNUCOBOL via OneCompiler.