Comments Example


Scenario - Describing the comments in the program.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       IDENTIFICATION DIVISION.
       PROGRAM-ID. COMMENTS.
       AUTHOR. THE PROGRAM IS WRITTEN BY MAINFRAMESTECHHELP FOR
               EXPLAINING ABOUT COMMENTS IN DETAIL.
       INSTALLATION. 01-JAN-2000.
       DATE-WRITTEN. 11-MAY-2021.
       DATE-COMPILED. 11-MAY-2021.
       SECURITY. NORMAL.
 
       DATA DIVISION.         *> Starting of DATA DIVISION
       WORKING-STORAGE SECTION.

      * FULL LINE COMMENT WITH * IN THE COLUMN 7 
      / FULL LINE COMMENT WITH / IN THE COLUMN 7 

       PROCEDURE DIVISION.
      * FULL LINE COMMENT IN THE PROCEDURE DIVISION.
           DISPLAY "DESCRIBING THE COMMENTS IN THE PROGRAM".
           STOP RUN.

Explaining Example -

In the above example:

  • THE PROGRAM IS WRITTEN BY MAINFRAMESTECHHELP FOR EXPLAINING ABOUT COMMENTS IN DETAIL, 01-JAN-2000, 11-MAY-2021, 11-MAY-2021, NORMAL - are the IDENTIFICATION DIVISION comments.
  • THE PROGRAM IS WRITTEN BY MAINFRAMESTECHHELP FOR EXPLAINING ABOUT COMMENTS IN DETAIL - is a multi-line comment.
  • FULL LINE COMMENT WITH * IN THE COLUMN 7, FULL LINE COMMENT WITH / IN THE COLUMN 7, FULL LINE COMMENT IN THE PROCEDURE DIVISION - are full line comments.
  • Starting of DATA DIVISION - is the floating comment.