All programs should follow the standard layout (see example).
Although not all sections are mandatory, incorporating them into a default program skeleton together with additional standard sections (such as exit program and display messages), provides a basis from which to continue coding.

Use continuous lines of comments to break the program up into its logical sections. Use the following convention:

Examples of dividers:


Note: Structured programming constructs should not cross-subsection boundaries. For example, the following should not occur:

Subroutines (in other words COBOL SECTIONS, must be preceded by one or two lines of text to indicate their function. This should follow the SECTION statement.

Code should be indented to indicate the structure. For example:

Note: Different sections should be separated by the ‘/ ‘ compiler directive in the continuation area, which directs the printer to advance to a new page. To identify this line further, a standard comment should follow this, for example ‘EJECT’.

Place each phrase of a file declaration on a new line. A comment statement, giving its full text name, must follow each file declaration statement:

Place each phrase of a program call statement on a new line:

A comment statement to indicate its function, contents, etc should precede each input record/data structure:

Code files in order of frequency of use. Generally, this will correspond to placing the most important file first. For interactive programs, this will be the display file. For batch programs, this will be the main file being processed. Place ancillary files last.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |