The PROGRAM-ID should be an eight character descriptive name of the program.
The AUTHOR must be the name of the student.
The date must include DATE-WRITTEN and DATE-COMPILED.
There must be remarks divided into specific paragraphs as indicated. The paragraph titles should be displayed in column twelve with the rest of the paragraph indented for clarity.
FUNCTION. Briefly state the function of the program.
INPUT FILES. List the internal name for each file used as input, followed by its disk file name and the sort sequence (if any) of the file.
OUTPUT FILES. List the internal name for each file used for output, followed by its disk file name and the sort sequence (if any) of the file.
PRINTER OUTPUT. Describe briefly each report generated by this program, including information about control breaks.
INTERFACE PROGRAMS. (FOR COURSES BEYOND COP 2120...) List the names (Program-Ids) of the programs called as well as cite the programs that call this subprogram.
INPUT-OUTPUT SECTION. Select files by the order in which they are used.
Insert a blank line before each 01 level number.
Level numbers.
Use non-contiguous level numbers in increments of five (05, 10, 15).
Indent each higher level number four columns to the right.
PICTURE clause.
PICTURE clauses must be vertically aligned in the program.
The PICTURE of a data item should agree with its primary usage. It should be alphanumeric unless used for computation, subscription or editing.
VALUE clauses must be vertically aligned in the program.
FILE SECTION.
Files should be defined in the same sequence as they were selected in the ENVIRONMENT DIVISION.
The file names should be descriptive of the function of the file.
Record names should be formulated to include the file description name and the word "RECORD".
Data items under the 01 level should be formulated to include a two character prefix that associates the data name with its record.
WORKING-STORAGE SECTION.
Data names should be descriptive of the function of the item.
Data names should be grouped under the 01 levels in the following order and prefixed as follows:
01 ACCUMULATORS.
Begin all data names with "A".
01 CONSTANTS.
Begin all data names with "C".
01 FLAGS.
Begin all data names with "F".
01 WORK-AREAS.
Begin all data names with "W".
01 PRINT-LINES.
Begin all data names with "P".
01 TABLES.
Begin all data names with "T".
Must be last entry in WORKING-STORAGE.
Data items that cannot logically be grouped in the above categories should be appropriately grouped and inserted in the above list in alphabetical order by the 01 level data name. (With the exception of 01 TABLES which is always the last entry.)
Data names under each 01 level should be formulated to include a two (or more, if necessary) character prefix that associates the data name with its record.
WORKING-STORAGE elementary items should have initial values except for edited items.
General.
1000-INITIALIZE.
2000-COMPUTE-TAX.
3000-PRINT-REPORT.
Your first paragraph should be 0000-MAIN or 0000-BEGIN or similar notation. The paragraphs listed above represent the first level paragraphs UNDER 0000-MAIN.
Each paragraph should contain a comment listing the paragraphs that PERFORM that paragraph, any paragraphs that this paragraph PERFORMs, the purpose of the paragraph and an explanation of any involved logic.
**FLOWER BOXES** Each paragraph must have a flower box preceding the paragraph name. Flower boxes must have the following information:
DESCRIPTION:CALLED BY:
CALLS:
Please refer to a Sample Program to view flower boxes. They are outlined in asterisks and are to appear like a box.
Start each verb on a new line. Use indentations of four spaces to the left for each continuation line of statements that exceed one line.
PERFORM each paragraph except the driver. Don't let the program control fall through from one paragraph to the next.
The MOVE CORRESPONDING verb and the ADD CORRESPONDING verb are prohibited.
The WRITE ... FROM format should be used whenever possible.
Use a separate line for the following:
Verbs with multiple conditions:
READ INPUT-FILE
AT END
MOVE "Y" TO S-EOF-INPUT
PERFORM 3200-OUT-OF-INPUT.
READ INPUT-FILE
AT END
MOVE "Y" TO S-EOF-INPUT
PERFORM 3200-OUT-OF-INPUT
END-READ.
Scope terminators are the preferred method of terminating READ
statements, and other statements, such as the IF, which has / may have a
conditional component. Multiple receiving fields for the same move
MOVE FIELD-A TO FIELD-B
FIELD-C.
Multiple LINKAGE areas in a USING statement
CALL "COBSUB2" USING LINK-AREA-1
LINK-AREA-2.
Multiple files OPENed or CLOSEd
OPEN INPUT INPUT-FILE
TRANSACTION-FILE
OUTPUT REPORT-FILE.
Do not say:
OPEN INPUT INPUT-FILE
INPUT TRANSACTION-FILE
INPUT OTHER-INPUT-FILE
OUTPUT REPORT-FILE
OUTPUT TRANSACTION-REGISTER.
A single "Input" or "Output" is preferred. When coding a series of sequential MOVE statements, align the word TO, as shown below:
MOVE PAGE-NUMBER TO P-HEADER-PAGE.
MOVE HEADING-LINE TO P-REPORT-LINE.
MOVE ZERO TO P-LINE-COUNT.
Literals should only be coded when the value will never need
to be modified and when the significance of that value is
very obvious.
ADD 1 TO A-PAGE-COUNT. (Acceptable)
MULTIPLY W-BASE-PAY BY 250. (Unacceptable)
Modularity.
A paragraph may not consist of a single PERFORM statement.
A paragraph has only one entrance and one exit.
IF.
Use of mixed mode (negative and positive) is discouraged. Avoid the use of a "NOT" in a compound IF statement.
The format for IF statements is the IF condition statement on one line, the action statement on the second line indented four spaces, the ELSE aligned with the IF on a separate line and the ELSE action statement on a separate line indented four spaces.
IF condition statement
action statement
ELSE
action statement.
As usual, the scope terminator is the preferred format:
IF condition statement action statement(s) ELSE action statement(s) END-IF
Arithmetic statements.
Statements involving fields with decimals should use the ROUNDED option.
COMPUTE statements should contain parentheses to insure proper ordering of computations.
To the exit of the same paragraph or section.
Maintain counts of all records from input files and of all record written to output files. Additional quality control information should be collected as needed (total number of errors, etc.) Print all counts at the end of each report or job process.
**********************************************************
STATISTICAL INFORMATION
**********************************************************
PERSONNEL INPUT RECORDS READ 9999
PERSONNEL OUTPUT RECORDS WRITTEN 9999
RECORDS IN ERROR 9999