Floating Comment Indicator
Floating Comment Indicator
Info! Inline comments are introduced by COBOL V5.1 and supported from v5.1. Previous versions (before COBOL V5.1) do not support inline comments.
- The floating comment indicator is used to add comments in the middle of the code line.
- The indicator begins with *> and sets the statements written after the indicator as comments.
- The comments starting with *> are called inline or floating comments.
- A floating comment line can begin anywhere in Area-A and Area-B.
Rules -
- Both characters (* and >) should be contiguous.
- A space should precede the floating comment indicator (*>).
Examples -
Scenario1 - Inline comment in Area-A.
Code -
----+----1----+----2----+----3----+----4----+----5
*> INLINE COMMENT LINE CAN BE UPTO END OF THE AREA-B.
Scenario2 - Inline comment in Area-B.
Code -
----+----1----+----2----+----3----+----4----+----5
01 WS-VAR PIC X(12). *> INLINE COMMENT
Practical Example -
Scenario - Floating comment code in COBOL program.
Code -
----+----1----+----2----+----3----+----4----+----5
...
PROCEDURE DIVISION.
*> Inline comment starts in Area-A
DISPLAY "INLINE COMMENT DISPLAY". *> Inline comment in Area-B
...