The Procedure Division is optional.
The Procedure Division in a program definition
, function definition
or method definition contains procedures to be executed. These procedures can be declarative and/or nondeclarative.
The Procedure Division for an object definition and a factory definition contains the methods that may be invoked on the object
or factory object.
The Procedure Division in a call prototype contains no procedures, except that it may contain the ENTRY statement.
The Procedure Division in a function prototype, method prototype or program prototype specifies the parameters and returning
item, if any.
where parameter-list is:
Comments:
The generic term procedure-division-header is described in the topic The PROCEDURE DIVISION Header.
Formats 1 and 2 can be used only in a program definition,
The declarative sentence shown above is a USE statement (see the topics The USE Statement, The USE FOR DEBUGGING Statement, and The USE BEFORE REPORTING Statement ). It specifies when the section is to be executed.
A procedure is composed of a paragraph or group of paragraphs, or a section or group of sections in the Procedure Division. A procedure-name is a word used to refer to a paragraph or section in the source element in which it occurs. It consists of a paragraph-name (that may be qualified) or a section-name.
If one paragraph is in a section, all must be.
A paragraph comprises a paragraph-name followed by a period and a space, and any number of sentences or, if the paragraph-name is omitted, one or more successive sentences following the PROCEDURE DIVISION header or a section header. It is terminated either immediately before the next paragraph-name or section-name or at the end of the Procedure Division, or, in the declaratives portion, with END DECLARATIVES.
A section comprises a section header followed by any number of paragraphs. It is terminated either immediately before the next section or at the end of the Procedure Division, or, in the declaratives portion, with END DECLARATIVES.
In a program definition
execution begins with the first statement in the Procedure Division, excluding declaratives. Statements are then executed in the order in which they are written, except where the rules indicate some other order.
This segment of the chapter deals with arithmetic and conditional expressions, common and input/output phrases, intrinsic functions and COBOL verbs.