Summary -

In this topic, we described about the below sections -

The IDENTIFICATION DIVISION should be the first division in each COBOL program. The IDENTIFICATION DIVISION names the program name, other items that are used to identify the program uniquely.

Syntax -

IDENTIFICATION DIVISION Syntax

The IDENTIFICATION DIVISION and PROGRAM-ID entries are mandatory. For a program, the first entry of the IDENTIFICATION DIVISION should be the PROGRAM-ID entry.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.

The IDENTIFICATION DIVISION is also used to identify the programmer who has to written the program.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
AUTHOR. MTH.

The remaining entries AUTHOR, INSTALLATION, DATE-WRITTEN, DATE-COMPILED, and SECURITY are optional, can appear in any order based on the requirement.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
AUTHOR. MTH.
INSTALLATION. MTH.
DATE-WRITTEN. 03-JUN-21.
DATE-COMPILED. 03-JUN-21.
SECURITY. CONFIDENTIAL.

All entries, including IDENTIFICATION DIVISION header should start in Area-A.

For example -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. IDDIVISN.                                            
                                                                        
       AUTHOR. THE PROGRAM WRITTEN BY MAINFRAMESTECHHELP FOR            
               EXPLAINING ABOUT IDENTIFICATION ENTRIES IN DETAIL.       
       INSTALLATION. MTH.                                               
       DATE-WRITTEN. 03-JUN-2021.                                       
       DATE-COMPILED. 03-JUN-2021.                                      
       SECURITY. NORMAL.

PROGRAM-ID -

PROGRAM-ID entry specifies the program name. It is mandatory and should be the first entry in the IDENTIFICATION DIVISION.

The program member name (PDS name/name in source library) and the PROGRAM-ID program-name may not be the same in all cases.

Program Naming Example

After compilation, the load module gets created with the program-name from the PROGRAM-ID. Therefore, the PROGRAM-ID program-name should be specified while executing the program.

Program Naming Example1

program-name -

A user-defined word or alphanumeric literal that identifies your program. Program-name is not a figurative constant.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.

Rules -

  • The name can be up to 30 characters in length.
  • Only the hyphen, underscore, digits 0-9, and alphabetic characters are allowed in the name.
  • At least one character should be alphabetic.
    For example -
    Valid Program-name Invalid Program-name
    I1234 12345
    9A-23 9-123
    9A_66 99_66
  • The hyphen can't be the first or last character.
    For example -
    Invalid Program-name Valid Program-name
    -NEWPROG N-EWPROG
    NEWPROG- NEWPRO-G

COMMON -

The COMMON clause uses only in nested programs. In addition, the COMMON clause specifies that the program named by program-name is contained within another program.

For example -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. IDMAINPR.                                            
       AUTHOR. MTH.                                                     
                                                                        
       PROCEDURE DIVISION.                                              
           ....
           ....
           STOP RUN.                                                    
                                                                        
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. IDNESTPR IS COMMON. 
       AUTHOR. MTH.                                                     
                                                                        
       PROCEDURE DIVISION.                                              
           ....
           ....
           STOP RUN.                                                    
                                                                        
       END PROGRAM IDNESTPR.                                            
       END PROGRAM IDMAINPR.                                            
**************************** Bottom of Data ****************************

INITIAL -

INITIAL clause uses only in the main program(not nested program) and all programs(nested programs) contained within the main program are set to their initial state when the main program (not nested) called with program-name. The INITIAL attribute is not supported for programs compiled with the THREAD option.

For example -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. IDMAINPR IS INITIAL.
       AUTHOR. MTH.                                                     
                                                                        
       PROCEDURE DIVISION.                                              
           ....
           ....
           STOP RUN.                                                    
                                                                        
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. IDNESTPR IS COMMON. 
       AUTHOR. MTH.                                                     
                                                                        
       PROCEDURE DIVISION.                                              
           ....
           ....
           STOP RUN.                                                    
                                                                        
       END PROGRAM IDNESTPR.                                            
       END PROGRAM IDMAINPR.                                            
**************************** Bottom of Data ****************************

The below things happen when a program is in the initial state -

  • The variables in the WORKING-STORAGE SECTION gets initialized.
  • If a VALUE clause specified with the variable, the variable gets initialized to the defined value. If a VALUE clause not specified with a variable, the initial value of the data item is undefined.
  • All files with internal file connectors with the program are reset (in terms of Mode).
  • All PERFORM statements and control mechanisms in the program are set to their initial states.
  • All GO TO statements in the program sets to its initial state.

AUTHOR -

Specifies the programmer name who written the program. AUTHOR is an optional entry and used for documentation purpose.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
AUTHOR. MTH.

INSTALLATION -

Specifies the location or company name where it the installed. INSTALLATION is an optional entry and used for documentation purposes.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
INSTALLATION. MTH.

DATE-WRITTEN -

Specifies the actual date of the program written. This is an optional entry and used for documentation purposes.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
DATE-WRITTEN. 03-JUN-21.

DATE-COMPILED -

Specifies the actual compilation date of the program that was written in the source listing. If a comment-entry is specified, the entire entry is replaced with the compilation date of the program. If the comment-entry is ignored, the compiler adds the current date to the line on which DATE-COMPILED is printed. This is an optional paragraph and used for documentation purposes.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
DATE-COMPILED. 03-JUN-21.

SECURITY -

Specifies the program confidentiality level for the understanding of developers or others who are working on the program. This is an optional entry and used for documentation purposes.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
SECURITY. CONFIDENTIAL.

Comment-entry -

The comment-entry in any of the optional entries can be any character’s combination of the computer. The comment-entry is written in Area-B on one or more lines. Comment-entries uses only for documentation, and they do not affect the program's meaning. Comment-entries do not allow a hyphen in the indicator area (column 7) for multiple lines.

For example -

IDENTIFICATION DIVISION.
PROGRAM-ID. IDDIVISN.
AUTHOR. MTH.
INSTALLATION. MTH.
DATE-WRITTEN. 03-JUN-21.
DATE-COMPILED. 03-JUN-21.
SECURITY. CONFIDENTIAL.

Practical Example -

Scenario - Below example describes how the IDENTIFICATION DIVISION coded in COBOL programming.

Code -

ID Program Code
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. IDENTDIV.                                            
                                                                        
       AUTHOR. THE PROGRAM WRITTEN BY MAINFRAMESTECHHELP FOR            
               EXPLAINING ABOUT IDENTIFICATION ENTRIES IN DETAIL.       
       INSTALLATION. MTH.                                               
       DATE-WRITTEN. 03-JUN-2021.                                       
       DATE-COMPILED. 03-JUN-2021.                                      
       SECURITY. NORMAL.                                                
                                                                        
       PROCEDURE DIVISION.                                              
                                                                        
           DISPLAY "IDENTIFICATION DIVISION EXAMPLE".                   
           STOP RUN.                                                    
**************************** Bottom of Data ****************************

Output -

ID Program Output

Explaining Example -

In the above example, IDENTIFICATION DIVISION is coded with all its entries.