Appendices

Cheat sheet, reserved words (selection), PICTURE clause reference, file status codes, standards and version history, learning resources and suggested study plan (12 weeks).

Appendices

45.1 Cheat sheet Quick reminders: STRING... DELIMITED BY... INTO... END-STRING, UNSTRING... DELIMITED BY "," INTO a b c END-UNSTRING, INSPECT x TALLYING n FOR ALL "A", INSPECT x REPLACING ALL "A" BY "B", x(start:length), SEARCH t AT END... WHEN..., SEARCH ALL t WHEN key(ix) = v, CALL "PGM" USING BY REFERENCE a BY CONTENT b, COPY BOOK REPLACING ==:P:== BY ==X==, SORT sd ON ASCENDING KEY k USING f GIVING g.

45.2 Reserved words (selection) COBOL has 400+ reserved words; these are the ones most often used accidentally as data names: ACCEPT ADD ADDRESS ALL ALSO ALTER AND ANY ARE AREA AT AUTHOR BEFORE BINARY BLANK BLOCK BY CALL CANCEL CHARACTER CLASS CLOSE CODE COLUMN COMMA COMP COMPUTE CONFIGURATION CONTENT CONTINUE CONTROL COPY COUNT CURRENCY DATA DATE DAY DEBUGGING DELETE DELIMITER DEPENDING DESCENDING DESTINATION DETAIL DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC ELSE END ENTRY ENVIRONMENT EQUAL ERROR EVALUATE EXCEPTION EXIT EXTEND EXTERNAL FALSE FD FILE FILLER FINAL FIRST FOOTING FOR FROM FUNCTION GENERATE GIVING GLOBAL GO GOBACK GREATER GROUP HEADING HIGH-VALUE IF IN INDEX INDEXED INITIAL INITIALIZE INPUT INSPECT INTO INVALID IS JUST KEY LABEL LAST LEADING LEFT LENGTH LESS LIMIT LINE LINES LINKAGE LOCAL-STORAGE LOW-VALUE MERGE MODE MOVE MULTIPLY NATIONAL NEGATIVE NEXT NOT NULL NUMBER NUMERIC OBJECT OCCURS OF OFF ON OPEN OR ORDER ORGANIZATION OTHER OUTPUT PAGE PERFORM POINTER POSITION POSITIVE PROCEDURE PROGRAM QUOTE RANDOM READ RECORD RECORDS REDEFINES REFERENCE RELATIVE RELEASE REMAINDER RENAMES REPLACE REPORT REPLACING RESERVE RETURN REWRITE RIGHT ROUNDED RUN SEARCH SECTION SELECT SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT SOURCE SPACE STANDARD START STATUS STOP STRING SUBTRACT SUM SUPPRESS SYNC TABLE TALLYING TERMINATE TEST THAN THEN THROUGH THRU TIME TIMES TO TOP TRUE TYPE UNSTRING UNTIL UP UPON USAGE USE USING VALUE VALUES VARYING WHEN WITH WORDS WORKING-STORAGE WRITE ZERO

Safe habit: always prefix your names (WS-DATE, WS-COUNT, WS-STATUS, WS-RECORD).

45.3 PICTURE clause reference Example → stored/displayed X(5) ← "AB" → AB + 3 spaces letter or space A(3) ← "ABC" UTF-8 (IBM 6.3+) S9(3) ← −5 → −005 implied decimal point 9V99 ← 1.5 → 150 9PP ← 300 → stored as 3 zero suppression with space ZZ9 ← 7 → two spaces + 7 zero suppression with * currency (fixed/floating) $$9 ← 7 → space + $7 Z,ZZ9 ← 1234 → 1,234 Z9.99 ← 1.5 → space + 1.50 minus sign if negative credit/debit symbol if negative 99CR ← −5 → 05CR 99B99 ← 1234 → 12 34 45.4 File status codes

Success; duplicate alternate key exists (allowed by WITH DUPLICATES)

Success; record length does not match the file description Success; OPTIONAL file not present (created or treated as empty)

Success; NO REWIND/REEL phrase on a non-tape file End of file (no next record)

Relative record number too large for the RELATIVE KEY Sequence error: key out of order on sequential write, or key changed before REWRITE

Duplicate key (primary, or alternate without DUPLICATES) Record not found / no record with that key

Boundary violation: disk full or key/relative number out of range on write Permanent I/O error (hardware/system)

Boundary violation on a sequential file (no more space) OPEN failed: file not found (non-optional file) OPEN mode not permitted for this file

OPEN on a file previously closed WITH LOCK OPEN conflict between file attributes and program description (record length, key, organization) OPEN on a file already open CLOSE on a file not open

REWRITE/DELETE without a prior successful READ (sequential access)

Record size boundary violation on WRITE/REWRITE READ after end of file or after an unsuccessful READ/START

READ/START on a file not open for INPUT or I-O WRITE on a file not open for OUTPUT, EXTEND, or I-O

REWRITE/DELETE on a file not open for I-O Implementor-defined (IBM: 92 logic error, 93 resource not available, 96 no DD statement, 97 VSAM open OK after implicit VERIFY; GnuCOBOL: 91–9x runtime/handler errors) 45.5 Standards and version history Standard / release COBOL-60 (CODASYL) First ANSI standard

File handling improvements, inter-program communication ANSI X3.23-1985 / ISO 1989:1985

Structured programming: scope terminators, EVALUATE, inline PERFORM, nested programs, reference modification Intrinsic functions amendment 42 intrinsic functions ISO/IEC 1989:2002

OO, free format, LOCAL-STORAGE, recursion, pointers, user-defined functions, national/boolean data, exceptions, EXIT PERFORM ISO/IEC 1989:2014

IEEE 754 floating point, dynamic-capacity tables, method overloading, rounding modes; some features made optional or obsolete ISO/IEC 1989:2023

LINE SEQUENTIAL, COMMIT/ROLLBACK, bit-manipulation, asynchronous messaging, new functions IBM Enterprise COBOL 5.x–6.x

New optimizing back end, ARCH-tuned code, JSON (6.1+), conditional compilation and NUMCHECK (6.2+), UTF-8 PIC U (6.3+), 64-bit LP(64) and user-defined functions (6.4+)

Production releases (3.1, 3.2) with broad standard and dialect support (IBM, Micro Focus, ACU) 45.6 Learning resources

Online (free): *Open Mainframe Project COBOL Programming Course* (github.com/openmainframeproject/cobol-programming-course); IBM Z Xplore (free z/OS account and challenges); *GnuCOBOL Programmer's Guide* (Gary Cutler) and *GnuCOBOL FAQ* (Brian Tiffin) via the GnuCOBOL SourceForge project; IBM Documentation (*Enterprise COBOL for z/OS Language Reference* and *Programming Guide*, *z/OS MVS JCL Reference*, CICS TS, Db2 for z/OS); IBM Redbooks such as *Introduction to the New Mainframe: z/OS Basics*; Zowe docs (docs.zowe.org) and the COBOL Check repository.

Books: *Murach's Mainframe COBOL* (Murach, Prince, Menendez); *Beginning COBOL for Programmers* (Michael Coughlan, Apress); *Modern Mainframe Development* (Tom Taulli, O'Reilly); *COBOL for the 21st Century* (Stern, Stern, Ley, Wiley); *Murach's OS/390 and z/OS JCL*, *Murach's CICS for the COBOL Programmer*, *DB2 for the COBOL Programmer* (Murach).

Community: Open Mainframe Project Slack (COBOL working group), r/cobol and r/mainframe, IBM TechXchange community, SHARE and GSE user groups, Planet Mainframe 45.7 Suggested study plan (12 weeks)

History, tools, first programs, fixed and free format Program structure, DATA DIVISION, PICTURE, USAGE

VALUE/REDEFINES/88 levels, DISPLAY/ACCEPT — Part I exercises

MOVE rules, arithmetic, IF/EVALUATE, PERFORM, structured design — Project 1

Tables, SEARCH, strings, intrinsic functions — Project 2 Files (sequential, indexed, relative), SORT/MERGE, control-break reports — Part II exercises, Project 3

Subprograms, nested/recursive programs, copybooks, debugging — Project 4

OO COBOL, JSON/XML, modern features, performance, testing — Part III exercises z/OS, TSO/ISPF, datasets, JCL (on IBM Z Xplore) — Project 5 Db2 embedded SQL — Project 6

CICS, IMS overview, batch vs online — Project 7 Modernization, DevOps, complete projects, best practices — Project 8 🎓 Final Words

You've traveled from a five-line HELLO program to indexed files, control-break reports, subprograms, JSON, embedded SQL, CICS transactions, JCL job streams, and DevOps pipelines. COBOL rewards precision: know exactly how every byte of your data is laid out, check every status code, and keep your logic structured and readable for the next programmer — who may maintain it for decades. The systems that move the world's money and benefits still run on COBOL, and they need people who understand both their heritage and their future. Build the capstone projects, get a free z/OS account on IBM Z Xplore, and join the community. Happy coding! 🏦

IDENTIFICATION DIVISION.
       PROGRAM-ID. CHEAT.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT IN-FILE ASSIGN TO "in.txt"
               ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WS-FS.
       DATA DIVISION.
       FILE SECTION.
       FD  IN-FILE.
       01  IN-REC                PIC X(80).
       WORKING-STORAGE SECTION.
       01  WS-FS                 PIC XX.
           88  FS-OK             VALUE "00".
       01  WS-AMT                PIC S9(7)V99 COMP-3 VALUE 0.
       01  ED-AMT                PIC -Z,ZZZ,ZZ9.99.
       PROCEDURE DIVISION.
           OPEN INPUT IN-FILE
           PERFORM UNTIL NOT FS-OK
               READ IN-FILE
                   NOT AT END DISPLAY IN-REC(1:20)
               END-READ
           END-PERFORM
           CLOSE IN-FILE
           COMPUTE WS-AMT ROUNDED = 100 / 3
               ON SIZE ERROR DISPLAY "OVERFLOW"
           END-COMPUTE
           MOVE WS-AMT TO ED-AMT
           DISPLAY "AMOUNT: " ED-AMT " " FUNCTION CURRENT-DATE(1:8)
           GOBACK.