Thursday, September 3, 2009

Procedures

* The paragraph name will be in column 10 as described above. Sentences should be indented by 2 from the paragraph name, appearing in column 12.
* If a sentence does not fit onto one line, the end of the sentence should be continued on the next line, indented by four from the first line of the sentence.
* Clauses which affect the execution of the statement should be placed on a separate line so they stand out. Since these are continuations of the statement, they too will be indented by four.
* Statements which are dependent on conditional code should be indented by two from the statement they are dependent on.
* Indent a scope terminator to match its corresponding verb.

The following pieces of code illustrate good indenting practices:

DATA DIVISION

01


MAJOR-ITEM.







05


INTERMEDIATE-ITEM-1.







10


MINOR-ITEM-1A





PIC X(5).




10


MINOR-ITEM-1B





PIC X(15).




05


INTERMEDIATE-ITEM-2.







10


MINOR-ITEM-2A





PIC X(20).




10


MINOR-ITEM-2B





PIC 99V99.


PROCEDURE DIVISION

GET-NEXT-RECORD.

READ INVENTORY-MASTER-FILE

AT END

DISPLAY "END OF FILE. RECORDS PROCESSED="

INV-RECORD-COUNT

SET END-OF-FILE-SWITCH TO TRUE

END-READ.