Home › COBOL Tutorial › COBOL paragraphs
COBOL paragraphs
Name a block of code and perform it.
In the procedure division, a paragraph is a name in Area A followed by a period and then statements. PERFORM paragraph-name runs it and returns, like calling a function. Several paragraphs can be grouped into a SECTION. STOP RUN ends the program, so put it before the other paragraphs.
Example code
IDENTIFICATION DIVISION.
PROGRAM-ID. PARAS.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "Start".
PERFORM GREET-PARA.
PERFORM GREET-PARA.
DISPLAY "End".
STOP RUN.
GREET-PARA.
DISPLAY "Hello from a paragraph".