Previous Topic: Calculation ChecksNext Topic: Coding Standards for COBOL Programs


Coding Structures and Program Logic

Use structured programming operations where possible. For example, use IF/END-IF rather than GO/LABEL.

Make use of the THEN and CONTINUE noise words to emphasize the structure. For COBOL ‘85, use an inline PERFORM statement if more than one statement lies within the THEN group, and use explicit scope terminators (such as END-IF and END-PERFORM) on all multi-statement constructs.

Avoid explicit branching (the use of the COBOL GO operation) as much as possible. Where you do use explicit branching, try to do so in a structured way, and to build up structured programming constructs, NEXT and PREVIOUS. In other words, branch only to the beginning or end of the current loop, never to an arbitrary point. The only legitimate use of the GO statements should be to achieve an ‘ITERATE’ or a ‘QUIT’.