Reading — step 1 of 4
Learn
COBOL doesn't run alone. On real mainframes it lives inside an ecosystem.
CICS — Customer Information Control System
IBM's transaction monitor. You write CICS programs in COBOL with EXEC CICS ... END-EXEC blocks:
EXEC CICS RECEIVE MAP('ORDER1') MAPSET('ORDERSET')
INTO(WS-ORDER-IN)
END-EXEC.
PERFORM PROCESS-ORDER.
EXEC CICS SEND MAP('ORDER1') MAPSET('ORDERSET')
FROM(WS-ORDER-OUT)
END-EXEC.
CICS handles:
- Multi-user concurrency (terminals)
- Database transactions (with COMMIT/ROLLBACK)
- Message queuing
- Recovery on failure
A "transaction" is one user interaction — submit a form, get a response. CICS shops do millions per minute.
DB2 / IMS
Mainframe databases. SQL embedded in COBOL:
EXEC SQL
SELECT NAME, BALANCE
INTO :WS-NAME, :WS-BALANCE
FROM CUSTOMERS
WHERE ID = :WS-CUST-ID
END-EXEC.
The :variable syntax is host variables — bridges between SQL and COBOL. The DB2 precompiler (DSNH) translates EXEC SQL into actual function calls.
IMS is hierarchical (pre-relational); DB2 is the relational standard. Both still in production at banks, insurance, and government.
JCL — Job Control Language
The shell that runs COBOL on z/OS. It's NOT COBOL — it's a separate language that defines batch jobs:
//MYJOB JOB (ACCT),'AdaL',CLASS=A,MSGCLASS=H
//STEP1 EXEC PGM=MYPROG,PARM='REPORT'
//INFILE DD DSN=PROD.CUST.DATA,DISP=SHR
//OUTFILE DD DSN=PROD.RPT.OUT,DISP=(NEW,CATLG)
//SYSOUT DD SYSOUT=*
//
JCL declares:
- A JOB (the batch job)
- One or more STEPs (programs to run)
- DD (Data Definition) — file allocations
- Conditional execution, parameters, return codes
Similar to a Bash script + Docker compose file rolled into one — but specific to z/OS.
VSAM
Virtual Storage Access Method — the file system. Three flavors:
- KSDS (Key-Sequenced Data Set) — indexed, sorted by key. Like a B-tree.
- ESDS (Entry-Sequenced) — append-only sequential.
- RRDS (Relative-Record) — fixed-position random access.
COBOL programs read/write VSAM files via FILE-CONTROL declarations.
RACF / ACF2
Mainframe access control. Every dataset, transaction, terminal user is permission-checked.
Migration: COBOL on modern systems
- GnuCOBOL — open source, runs on Linux/Mac/Windows. What Judge0 uses.
- Micro Focus Visual COBOL — commercial, integrates with .NET / Java.
- IBM COBOL for Linux on x86 — IBM's port to Linux, identical to z/OS
Most banks running COBOL are slowly migrating:
- Wrap COBOL with REST APIs (often via z/OS Connect)
- Move batch jobs to Linux (JCL → shell scripts, VSAM → DB)
- Rewrite gradually in Java/Go (NEVER "big bang")
Why COBOL persists
- 220+ billion lines of COBOL in production (Reuters estimate)
- Trillions of dollars of business logic encoded in it
- Migration risk: even a tiny bug in a payroll system affects millions
- Mainframe reliability: z/OS systems hit 5-nines uptime; rebuilding that on commodity hardware is non-trivial
Most COBOL maintenance is business knowledge transfer — the languages just isn't that hard. The hard part is understanding what 50 years of accreted business rules actually do.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…