PROCEDURE DIVISION
The part of a COBOL program that contains the actual logic, the statements that run.
Also written PROCEDURE DIVISION
The PROCEDURE DIVISION is where a COBOL program does its work. Everything before it describes data; this is the code.
It is organised into paragraphs, each with a name, containing sentences made of statements. Statements read close to English: move a value into a field, add one to a counter, read the next record, write a line, evaluate a condition, call another program.
Control flow is deliberately plain. PERFORM runs a paragraph and comes back, and is also how loops are written. IF and EVALUATE make decisions. There is a GO TO, and in older code you will meet it, but modern practice avoids it in favour of structured PERFORM logic.
A typical batch program has an unmistakable shape: an opening paragraph that opens files and initialises, a main loop that reads a record and processes it until the file is exhausted, and a closing paragraph that writes totals and closes files. Recognising that shape makes most business COBOL immediately readable, because thousands of programs follow it.
Related terms
- COBOL divisionsThe four fixed sections every COBOL program is built from, always in the same order.
- PERFORMThe COBOL statement that runs a paragraph and returns, and the way loops are written.
- EVALUATECOBOL's multi-way decision statement, and a clearer alternative to a long chain of nested IFs.
- WORKING-STORAGEThe section of a COBOL program that declares its internal variables: counters, totals, flags and work areas.
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.