In the olden days, the COBOL program needed to be punched on the card and loaded to a punch card reader.

There was a need for a coding structure to identify the program code by the punch card reader.

The below picture shows the coding form used in the olden days -

COBOL Punched Card

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

Nowadays, punched cards are replaced by editors, and the coding sheet is converted as a reference format.

One should write the COBOL source code in the boundaries shown in the COBOL reference format. The reference format contains 80 columns for each line/row.

The below diagram clearly shows the reference format/coding sheet at each column level -

Coding sheet

Coding Sheet Split-up -

On coding forms,

Positions Description
1 - 6 Sequence number area
7 Reserved for one of the below characters -
  • Print character (/ - forward slash)
  • Continution Chatacter (-)
  • Comment character (* - Asterisk)
  • Debugging Character (D)
8 - 11 Area A (all division names, section names, paragraph names, FD entries and 01 level numbers coding should start in this area)
12 - 72 Area B (all other sentences except the above coding should start in this area)
73 - 80 System-generated number area

1-6 Columns (Sequence Number Area) -

  • A total of six columns are reserved for sequence number.
  • The content can be a combination of any character of the computer.
  • Sequence number automatically gets incrased on every addition of new line.
  • One can use the sequence number area to label a project or defect. Because of this, the area also called as Tag Area. For example - In the real-time environment, if we are inserting a code for some project number 67328/ defect number 31456, it can be coded in the sequence area like below for identifying the code easily -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    P67328     MOVE A TO B.                                                 
    P67328     MOVE C TO D.          
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    D31456     MOVE A TO B.                                                 
    D31456     MOVE C TO D.          
  • These six columns are subdivided into three columns each.
    • Page Number(1-3 Columns)
    • Line Number(4-6 Columns)

1-3 Columns (Page Number) -

  • Represents the page number.
Codingsheet program Code

4-6 Columns (Line Number) -

  • Represents the line number.
Codingsheet program Code
Tip! To add the sequence number automatically to COBOL program, execute the below command in the code editor.
NUM ON STD COBOL

7th Column (Indicator Area) -

Reserved for special characters. Those special characters are -

  • * - Commenting indicator.
  • - - Continution indicator.
  • / - Printer stopper indicator.
  • D - Debugging inicator.
Codingsheet program Code
  • "*" → "*" used for commenting a line. If the "*" is coded on the 7th column of a line, the COBOL compiler considers that line as a comment.
    For example -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    000005* THIS IS COMMENT LINE                                            
  • "-" → "-" used for continuation of the previous line. If "-" is coded on the 7th column of a line, the COBOL compiler understands that the current line is a continuation of the 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 and specifies that the printing should start from new page.
    For example -
    ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    000007/    DISPLAY "PRINTER STOPPER LINE".                              
  • "D" → "D" is used as a debugging indicator. Suppose the "D" is coded on the 7th column of a line; the COBOL compiler understands that line is used for DEBUGGING purposes. The line is enabled when DEBUGGING MODE is enabled in the program. In all other cases, the line considers as a comment or 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 (Program Body) -

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

  • 8-11 Columns (Area A)
  • 12-72 Columns (Area B)

8-11 Columns (Area A) -

All the DIVISION headers, SECTION headers, PARAGRAPH headers, PARAGRAPH names, Level number (FD and SD), DECLARATIVES, 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 apart from above and sentences coding should start in AREA B. All entries, sentences, statements. clauses and continuous lines should code 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 (System Generated Number) -

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

While printing the program, these columns consider for printing because the system recognizes 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 ************************************