COBOL for the Mainframe
From your first DISPLAY to batch jobs that read, sort and report on real business data. Built for people training for mainframe COBOL roles.
First Steps
Where COBOL runs and why it still matters, how a program is laid out in fixed-format columns, writing output with DISPLAY, reading input with ACCEPT, and fixing the compiler errors you will inevitably hit.
Data and PICTURE
How COBOL describes data: level numbers, PICTURE strings, implied decimals and signs, VALUE and figurative constants, the rules MOVE follows, and edited pictures that turn raw numbers into report-ready text.
Arithmetic
ADD, SUBTRACT, MULTIPLY, DIVIDE and COMPUTE; rounding, overflow, numeric functions, and how COBOL stores numbers so money adds up to the cent.
- ADD and SUBTRACT exercise · 12m
- MULTIPLY and DIVIDE exercise · 14m
- ROUNDED and truncation exercise · 12m
- ON SIZE ERROR exercise · 14m
- COMPUTE and operator precedence exercise · 15m
- Numeric intrinsic functions exercise · 14m
- USAGE: DISPLAY, COMP and COMP-3 quiz · 12m
- Challenge: invoice totals exercise · 30m
Conditions
IF and EVALUATE, class and sign tests, level-88 condition names, and the period pitfalls that have caused real production outages.
- IF, ELSE and END-IF exercise · 14m
- Class and sign conditions exercise · 12m
- Level-88 condition names exercise · 14m
- Compound and abbreviated conditions exercise · 14m
- EVALUATE exercise · 14m
- EVALUATE ... ALSO decision tables exercise · 15m
- CONTINUE vs NEXT SENTENCE quiz · 10m
- Challenge: motor insurance rating exercise · 35m
Loops and Program Structure
Paragraphs, sections and every form of PERFORM, from simple calls to nested VARYING loops, and the initialise / process / terminate skeleton that nearly every batch program follows.
- Paragraphs, sections and PERFORM quiz · 12m
- PERFORM n TIMES and inline PERFORM exercise · 12m
- PERFORM UNTIL, TEST BEFORE and TEST AFTER exercise · 14m
- PERFORM VARYING and nested loops exercise · 15m
- The batch program skeleton exercise · 15m
- GO TO and reading legacy code exercise · 15m
- Module challenge: loan amortisation schedule exercise · 30m
Tables
COBOL's arrays: OCCURS, subscripts and indexes, loading tables from input, serial and binary SEARCH, hard-coded lookup tables, two-dimensional and variable-length tables, and the out-of-range bugs that corrupt storage.
- OCCURS and subscripts quiz · 14m
- Loading a table from input exercise · 14m
- Hard-coded tables, INDEXED BY and SET exercise · 16m
- Serial SEARCH exercise · 14m
- Binary search with SEARCH ALL exercise · 15m
- Two-dimensional tables exercise · 15m
- Variable-length tables with OCCURS DEPENDING ON exercise · 15m
- Module challenge: sales by region and quarter exercise · 35m
Working with Text
Slice, build, split and clean text in fixed-length fields: reference modification, STRING, UNSTRING, INSPECT and the intrinsic string functions, then parse and validate CSV data the way real interface programs do.
- Text in a fixed-width world quiz · 10m
- Reference modification exercise · 12m
- Building text with STRING exercise · 14m
- Splitting text with UNSTRING exercise · 15m
- Counting and replacing with INSPECT exercise · 14m
- String intrinsic functions exercise · 12m
- Parsing CSV and NUMVAL exercise · 15m
- Challenge: customer feed loader exercise · 30m
Sequential Files
Datasets, DD names and record layouts. Read, write, extend and update sequential files, check every FILE STATUS, and build the classic batch master-file update.
- Datasets, DD names and FDs quiz · 12m
- Reading a file with the priming read exercise · 14m
- Writing files, filtering and reformatting exercise · 15m
- FILE STATUS and return codes exercise · 15m
- Fixed-length records exercise · 15m
- OPEN EXTEND and REWRITE exercise · 15m
- The match-merge master file update exercise · 20m
- Challenge: nightly account update exercise · 40m
Indexed Files and SORT
Keyed access to master files (VSAM KSDS on z/OS): random reads, browsing with START and READ NEXT, adding, changing and deleting records, plus the SORT and MERGE verbs that put batch input into the order your logic needs.
- Indexed files and VSAM quiz · 14m
- Random READ by key exercise · 12m
- Loading a KSDS with WRITE exercise · 12m
- Browsing with START and READ NEXT exercise · 14m
- REWRITE and DELETE exercise · 14m
- SORT with USING and GIVING exercise · 12m
- SORT with input and output procedures exercise · 15m
- Challenge: overnight customer maintenance exercise · 40m
Batch Reports
The printed report, still the most common output of a batch job: print line layouts, edited money, page headings and page breaks, and single- and multi-level control breaks with subtotals and grand totals.
- Anatomy of a batch report quiz · 12m
- Formatting money for print exercise · 14m
- Print lines and report files exercise · 14m
- Line counting and page breaks exercise · 14m
- Control breaks and subtotals exercise · 15m
- Multi-level control breaks exercise · 15m
- Challenge: monthly sales report exercise · 45m
Subprograms and Copybooks
How real mainframe systems are split into many programs: CALL with USING, the LINKAGE SECTION, BY REFERENCE and BY CONTENT, RETURN-CODE, GOBACK versus STOP RUN, static and dynamic calls, CANCEL, nested programs, and COPY copybooks that keep record layouts identical across every program that uses them.
- Why shops split code into subprograms quiz · 12m
- CALL, USING and the LINKAGE SECTION exercise · 15m
- Nested programs and END PROGRAM exercise · 15m
- BY CONTENT and BY VALUE exercise · 14m
- GOBACK, STOP RUN and RETURN-CODE exercise · 15m
- Static and dynamic CALL, CANCEL and ON EXCEPTION exercise · 16m
- Copybooks and COPY REPLACING exercise · 16m
- Challenge: the nightly claims intake exercise · 40m
JCL and Batch Jobs
How a batch job flows through JES, writing JOB, EXEC and DD statements, dataset dispositions, temporary datasets, SYSIN and PARM, return codes and COND, the everyday utilities IEFBR14, IEBGENER and DFSORT, and reading a job log when a step abends.
- How a batch job runs quiz · 12m
- JOB, EXEC and DD statements exercise · 15m
- DD statements and DISP exercise · 18m
- Temporary datasets and SYSOUT exercise · 15m
- Feeding a program with SYSIN and PARM exercise · 15m
- Return codes and COND exercise · 18m
- IEBGENER and DFSORT exercise · 20m
- Reading a job log and common abends exercise · 18m
- Challenge: the nightly stock run exercise · 30m
Mainframe Internals and Capstone
What your data looks like at the byte level on z/OS: EBCDIC, zoned and packed decimal, binary and SYNC. Why S0C7 happens and how to prevent it, VSAM and IDCAMS, a tour of CICS and Db2, reading abend codes and dumps, then a full end-of-day batch capstone and a plan for getting hired.
- EBCDIC, ASCII and sort order quiz · 12m
- Signed zoned decimal and overpunch exercise · 15m
- Packed decimal at the byte level exercise · 18m
- COMP, BINARY and SYNC quiz · 12m
- Data exceptions and S0C7 exercise · 18m
- VSAM and IDCAMS quiz · 15m
- CICS and Db2 in a nutshell quiz · 18m
- Abend codes and reading dumps quiz · 16m
- Capstone: claims end-of-day batch exercise · 60m
- Next steps: getting hired reading · 10m