COBOL divisions
The four fixed sections every COBOL program is built from, always in the same order.
Also written divisions, identification division, environment division
A COBOL program is organised into four divisions, and they always appear in the same sequence. That rigidity is one of the things that makes unfamiliar COBOL navigable, because you always know roughly where you are.
IDENTIFICATION DIVISION comes first and names the program. It is short, often just a program name and some comments about what it does and who changed it last.
ENVIRONMENT DIVISION describes the connection to the outside world, chiefly which files the program uses and what internal names it gives them. Those names are what the JCL then supplies real datasets for.
DATA DIVISION declares everything the program works with: the layout of each record it reads or writes, and the variables it uses while running. In a typical business program this is a large section, because business records have a lot of fields.
PROCEDURE DIVISION holds the actual logic, the statements that run.
Divisions contain sections, sections contain paragraphs, and paragraphs contain sentences. That hierarchy is consistent throughout.
Related terms
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.
- DATA DIVISIONThe part of a COBOL program that declares every record layout and variable it will use.
- PROCEDURE DIVISIONThe part of a COBOL program that contains the actual logic, the statements that run.
- WORKING-STORAGEThe section of a COBOL program that declares its internal variables: counters, totals, flags and work areas.
- File descriptionThe FD entry in a COBOL program that describes a file's records, connecting the program to data supplied by the JCL.