COBOL Cheat Sheet
Structural COBOL reference covering divisions, data definitions, procedure verbs, and basic file handling for legacy systems.
3 PagesIntermediateApr 5, 2026
Program Structure
The four divisions of a COBOL program.
cobol
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-GREETING PIC X(20) VALUE "Hello, World!". PROCEDURE DIVISION. DISPLAY WS-GREETING. STOP RUN.
Data Division
Declaring records and fields with PICTURE clauses.
cobol
DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-EMPLOYEE. 05 WS-NAME PIC X(30). 05 WS-AGE PIC 9(3). 05 WS-SALARY PIC 9(7)V99. 01 WS-COUNTER PIC 9(4) VALUE ZERO. 01 WS-FLAG PIC X VALUE "N". 88 WS-DONE VALUE "Y".
Procedure Division Verbs
Common statements used in the Procedure Division.
- MOVE a TO b- Assigns/copies the value of a into b
- ADD a TO b- b = b + a
- COMPUTE x = a + b * c- Arithmetic expression assignment
- IF cond THEN ... ELSE ... END-IF- Conditional branching
- PERFORM para-name- Executes a named paragraph (like calling a routine)
- PERFORM UNTIL cond ... END-PERFORM- Loops until a condition becomes true
Common Clauses & Concepts
Frequently used declaration clauses.
- PIC 9(5)- Numeric picture clause, 5 digits
- PIC X(20)- Alphanumeric picture clause, 20 characters
- VALUE- Sets an initial literal value for a data item
- OCCURS n TIMES- Declares an array/table of n elements
- 01, 05, 88- Level numbers defining record hierarchy and condition names
- COPY member.- Includes a copybook of shared data or code
File Handling
Opening, reading, and closing a sequential file.
cobol
ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CUSTOMER-FILE ASSIGN TO "CUST.DAT" ORGANIZATION IS LINE SEQUENTIAL. PROCEDURE DIVISION. OPEN INPUT CUSTOMER-FILE. READ CUSTOMER-FILE AT END DISPLAY "EOF reached". CLOSE CUSTOMER-FILE.
Pro Tip
COBOL source columns matter in fixed format: Area A starts at column 8 (division/section/paragraph headers), Area B at column 12 (statements) — misaligned code fails to compile.
Was this cheat sheet helpful?
Explore Topics
#COBOL#COBOLCheatSheet#Programming#Intermediate#ProgramStructure#DataDivision#ProcedureDivisionVerbs#CommonClausesConcepts#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance