Summary -

In the olden days, COBOL program needs to be punched on the card and card loaded to punch card reader. There was a need of coding structure to identify the program coding by the punch card reader.

Below picture shows the punched card used in olden days -

COBOL Punched Card

The COBOL coding structure used to identify the COBOL coding statements from where it starts and where it ends. The COBOL coding structure is known as COBOL Coding sheet.

Now a days, punched cards replaced by editors and the coding sheet converted as a reference format. COBOL source text must be written in COBOL reference format.

The reference format contains 80 columns for each line/row. Below diagram clearly shows the reference format/coding sheet at each column level -

Coding sheet

Coding Sheet Split-up -

On coding forms,

  • The first six positions(1-6) are reserved for sequence numbers.
  • The seventh position7th is reserved for the continuation character (/ - forward slash), or for an asterisk (*) that denotes a comment line.
  • The actual program starts from column 8. The four positions from 8 to 11 are known as Area A, and all division names, section names, paragraph names, FD entries and 01 level numbers coding must start in Area A.
  • Positions from 12 to 72 are Area B and all other sentences coding must start in Area B.
  • Positions from 73 to 80 are reserved for system generated number.

1-6 Columns (Sequence Number Area) -

These six columns are sub divided into 3 columns each. The total six columns are treated as sequence number. The sequence number area can also be used to label a source statement line. The content can be a combination of any character of the computer.

1-3 Columns -

Reserved for page number. Page numbers gets automatically increased along with the lines of code adding to the program.

Codingsheet program Code

4-6 Columns -

Reserved for Line number. Line numbers gets automatically increased along with the lines of code adding to the program.

Codingsheet program Code

7th Column (Indicator Area) -

Reserved for special characteristics.

Codingsheet program Code

  • "*" --> Used for commenting a line. If the "*" is coded on the 7th column in the program, the COBOL compiler considers that line as comment.
    For example -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    000005* THIS IS COMMENT LINE                                            
  • "-" --> Used for Continuation of previous line. If "-" is coded on the 7th column in the program, the COBOL compiler understands that the current line is continuation of previous line.
    For example -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7-- 
    000001 01 WS-VAR           PIC X(50) VALUE "THIS IS MULTILINE NONNUMERIC
    000002-      "LITERAL SPREAD ON TWO LINES".                             
  • "/" --> Used for printer stopper.
    For example -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    000007/    DISPLAY "PRINTER STOPPER LINE".                              
  • "D" --> Debugging indicator. If the "D" is coded on the 7th column in the program, the COBOL compiler understands that the current line is used for DEBUGGING purpose. The line is enabled when DEBUGGING MODE enabled in the program. In all other cases, it considers as a Dummy line.
    For example -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    ***************************** Top of Data ******************************
    000001 IDENTIFICATION DIVISION.                                         
    000002 PROGRAM-ID. CODSHEET.                                            
    000003 AUTHOR. MTH.                                                     
    000004 SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.                    
    000005 OBJECT-COMPUTER. IBM-370.                                        
    000006                                                                  
    000007 PROCEDURE DIVISION.                                              
    000008                                                                  
    000009D    DISPLAY "DEBUGGING MODE DISPLAY".                            

8-72 Columns -

Represents the body of the program where the COBOL statements be coded. The COBOL body was divided into two areas.

8-11 Columns (Area A) -

All the DIVISION headers, SECTION headers, PARAGRAPH headers, PARAGRAPH names, Level number (FD and SD), DECLARATIVES and END DECLARATIVES, end method makers and FD entries coding should start in AREA A. Along with the above, 01 and 77 level numbers coding also should start in AREA A. Codingsheet program Code

12-72 Columns (Area B) -

All other Statements, Sentences coding should start in AREA B. All entries, sentences, statements. clauses and continuous lines should be coded in Area B.

Codingsheet program Code

8-72 Columns (Area A and Area B) -

Below items can begin in either in Area A or Area B.

73-80 Columns -

Reserves for System Generated Number. Used for Identification purpose.COBOL Compiler not consider this as a part of the program.

While printing the program, these columns considers for printing because the system considers 80 characters per line.

Codingsheet program Code

Practical Example -

Scenario - Below example describes how the coding sheet look like along with code.

Code -

Codingsheet program Code
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
***************************** Top of Data **************************************
000001 IDENTIFICATION DIVISION.                                         00010000
000002 PROGRAM-ID. CODSHEET.                                            00020000
000003 AUTHOR. MTH.                                                     00030001
000004                                                                  00040001
000005 PROCEDURE DIVISION.                                              00050001
000006                                                                  00060001
000007     DISPLAY "CODING SHEET STRUCTURE DEMO".                       00070001
000008     STOP RUN.                                                    00080001
**************************** Bottom of Data ************************************

Explaining Example -

In the above example, we have shown how the program is divided into different predefined areas as per the coding sheet.