isCOBOL Evolve : Language Reference : Program Structure
Program Structure
Synopsis
The schema below shows how a COBOL program is structured. For simplifying access to information, it has been split into smaller parts.
 [{IDENTIFICATION} DIVISION. ]
  {ID            }
 
  { {PROGRAM-ID }. Program-Name [ IS {INITIAL } PROGRAM ] .
    {FUNCTION-ID}                    {RESIDENT}
 
      [ AUTHOR. [Comment-Entry .] ]
 
      [ INSTALLATION. [Comment-Entry .] ]
 
      [ DATE-WRITTEN. [Comment-Entry .] ]
 
      [ DATE-COMPILED. [Comment-Entry .] ]
 
      [ SECURITY. [Comment-Entry .] ]
 
      [ REMARKS. [Comment-Entry .] ]
 
 
      [ DATA DIVISION. ]
 
 
      [ END PROGRAM [ Program-Name ]. ] }
 
 
  { CLASS-IDClass-Name [ AS Literal ]
 
                           [ INHERITS FROM Class-Name ]
 
                           [ IMPLEMENTS { Interface-Name } ... ] .
  
      [ AUTHORComment-Entry . ]
 
      [ INSTALLATIONComment-Entry . ]
 
 
      [ DATE-WRITTENComment-Entry . ]
 
      [ DATE-COMPILEDComment-Entry . ]
 
      [ AUTHORComment-Entry . ]
 
      [ INSTALLATIONComment-Entry . ]
 
      [ DATE-WRITTENComment-Entry . ]
 
      [ DATE-COMPILEDComment-Entry . ]
 
      [ SECURITYComment-Entry . ]
 
      [ REMARKSComment-Entry . ]
 
 
      [ {IDENTIFICATIONDIVISION.
        {ID            }
 
        FACTORY.
 
          [ ENVIRONMENT DIVISION. ]
 
          [ DATA DIVISION. ]
 
          [ PROCEDURE DIVISION.
 
            [ {IDENTIFICATION} DIVISION.
              {ID            }
 
              METHOD-IDMethod-Name [ AS Literal ] [ IS {PUBLIC   } ] [ OVERRIDE ].
                                                         {PRIVATE  }
                                                         {PROTECTED}
 
                [ ENVIRONMENT DIVISION. ]
 
                [ DATA DIVISION. ]
 
                PROCEDURE DIVISION
 
                END METHOD [ Method-Name ]. ] ... ]
 
          END FACTORY. ]
 
      [ {IDENTIFICATIONDIVISION.
        {ID            }
 
        OBJECT.
 
          [ ENVIRONMENT DIVISION. ]
 
          [ DATA DIVISION. ]
 
 
          [ PROCEDURE DIVISION.
 
            [ {IDENTIFICATION} DIVISION.
              {ID            }
 
              METHOD-IDMethod-Name [ AS Literal ] [ IS {PUBLIC   } ] [ OVERRIDE ].
                                                         {PRIVATE  }
                                                         {PROTECTED}
 
                [ ENVIRONMENT DIVISION. ]
 
                [ DATA DIVISION. ]
 
                PROCEDURE DIVISION
 
                END METHOD [ Method-Name ]. ] ... ]
 
          END OBJECT. ]
      [ END CLASS [ Class-Name ]. ] }
Syntax rules
1. Program-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
2. Each reference to Comment-Entry is a Comment-Entry, as defined in the Definitions section in the Preface of this document.
3. Each reference to Class-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
4. Interface-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
5. Each reference to Method-Name is a User-defined word, as defined in the Definitions section in the Preface of this document.
6. Each reference to Literal is a Nonnumeric Literal, as defined in the Definitions section in the Preface of this document.
General rules
1. PROGRAM-ID (or its synonymous FUNCTION-ID) and CLASS-ID cannot appear together in the same program.