Cobol Standards

Area:
Languages

Topic:
Cobol

Standard:
Production Cobol must be written according to specified guidelines.

Procedures:
Use standard Cobol numbers.

All in-house written programs must be written for Cobol II.

Use a complete Identification Section, including Author, Program ID, Date Written and Remarks.

The Remarks section of the Identification Division should include a brief description of the program and should include a Maintenance Log. The Maintenance Log should include date of change, initials of the person making the change and the content or nature of the change (including request number, if appropriate).

Separate divisions, file descriptions, 01 level items with multiple level entries and paragraphs with blank lines.

When modifying an existing program, include an entry in the Maintenance Log in the Remarks section of the Identification Division.

When modifying an existing program that is not part of a purchased package, place your initials followed by the date (iimmyy) in columns 73-78 of each statement changed.

When modifying an existing program that is part of a purchased package, place an indicator in columns 73-80 to identify the program modification.

Select statements and file descriptions should be in the order of input files, output files, work files and files defined as I-O.

Use a separate FD for each report generated.

All record descriptions of cataloged datasets should be fetched from a standard copy member.

Record description copy members should contain the field location in columns 73-80. The field location should contain the beginning and ending position for each field referenced. This may conflict with using these columns for indicating initials and date of change. Under these circumstances, the change should only be noted in the Maintenance Log.

Use 01 levels in Working Storage to group related entries.

Do not use an 01 level field as an elementary item. 01 level items may not have a Picture clause.

Increment Data Division levels by at least 2 (01, 03, 05, etc.).

Do not use 77 level items.

Use 88 levels whenever possible to clarify any flags used.

All code definitions should be external to the program. Example

All copy members shoud use the standard Cobol heading.

Paragraph names should describe the purpose or function of the paragraph.

Paragraph/Section names should be composed of a sequence number followed by the purpose or function.

Each paragraph should perform only one function.

Use adequate comment lines to clarify processing.

Only Paragraphs/Sections that are used in more than one place in the program or that interrupt the smooth flow of a program may be performed.

When performing more than one paragraph, use an exit paragraph.

Open files in a separate paragraph.

Close files in a separate paragraph.

Put Stop Run in a separate paragraph.

Output all input parameters (with program name) on a separate page from reports.

Use only one verb per statement.

On statements requiring more than one line, consistently indent all lines after the first.

Do not use commas as grammatical separators.

Place Else on a line by itself.

Avoid nested If statements.

Avoid use of internal sorts.

Avoid nested Perform statements.

Minimize Go To statements.

Use only one Open, Close, Write (except for printed output), Rewrite, Delete, Start or Read per file.

Do not use the Cobol report generator feature.

Do not use Display Upon Console.

When the program ends, output all relevant file statistics, including records in, records out, errors, forms printed, entity totals, etc.

Print all errors detected with meaningful messages to a separate file. If error reports are to go to different offices, output error reports to different files.

When necessary, use a Return Code of 6 or 7 to indicate a condition within a program that may affect subsequent steps.

Programs should trap all forseeable error conditions that may occur during processing.

Include title, program name, date and page number (if more than one page) on all reports unless otherwise specified by the user.

Use setups for labels and special forms.

Changes to a Cobol program should be in the same style as the unmodified program.

Notes:
Standard Cobol numbers can be set by using your Profile Option "Numbers on COB".

The standard Cobol Identification Division is in the ISP14 Panvalet library with a member name of STDCOB.

The standard Cobol copy member heading is in the ISP14 Panvalet library with a member name of STDCOBCM.

Call routines may be located at the bottom of the program in separate paragraphs.

Cobol programs in Panvalet should have a language type of Cobol.

The Go proc should be used on the Exec statement of a Cobol step in JCL.

Assigned Return Codes may be documented in the program.

Sample Cobol Program


Standards


Last Modified: Tuesday, 28-Nov-2000 10:38:29 CST

©1999 All Rights Reserved