Paragraph
A named block of statements in the PROCEDURE DIVISION, the unit that PERFORM runs.
Also written COBOL paragraph, section, paragraph name
In COBOL, the code in the PROCEDURE DIVISION is split into paragraphs. A paragraph starts with a name followed by a full stop, written at the left of the code area, and continues until the next paragraph name. PERFORM runs a paragraph and then comes back.
Paragraph names are chosen by the programmer and are often numbered to show the structure, such as 1000-OPEN-FILES, 2000-PROCESS-RECORD and 9000-CLOSE-FILES. The numbers have no meaning to the compiler. They help a reader find each part of a long program.
Paragraphs can be grouped into sections. A section has a name followed by the word SECTION and contains one or more paragraphs. PERFORM on a section runs every paragraph in it, in order.
A good COBOL program reads like a list of steps: a main paragraph that performs other paragraphs, each doing one job. When you first open an unfamiliar program, reading the main paragraph and the names it performs is a quick way to understand what the program does.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- PROCEDURE DIVISIONThe part of a COBOL program that contains the actual logic, the statements that run.
- PERFORMThe COBOL statement that runs a paragraph and returns, and the way loops are written.
- COBOL divisionsThe four fixed sections every COBOL program is built from, always in the same order.
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.
- EVALUATECOBOL's multi-way decision statement, and a clearer alternative to a long chain of nested IFs.