At the compilation unit level, COBOL2000 offers debugging lines for the diagnosis of logical errors. These are specially identified lines in the compilation unit which
contain only COBOL statements for test purposes and
at compile time can be treated as statement lines or comment lines, as necessary.
COBOL2000 supports the use of debugging lines with the following language elements (see “COBOL2000 Reference Manual” [1]):
The WITH DEBUGGING MODE clause in the SOURCE-COMPUTER paragraph of the ENVIRONMENT DIVISION:
This clause defines how debugging lines are to be treated by the compiler: If the clause is specified, debugging lines are compiled as normal statement lines; if it is not specified, the compiler treats debugging lines as comment lines.
This feature allows debugging lines to be left untouched in the compilation unit after the test phase. Only the WITH DEBUGGING MODE clause has to be removed before the program is compiled for productive use.
The identification of debugging lines by means of a “D” in the indicator area (column 7): A “D” in column 7 of a line specifies that the line is to be treated either as a statement line or as a comment line by the compiler, depending on whether or not the WITH DEBUGGING MODE clause is present.
When defining debugging lines, the following should be noted:
In the compilation unit, debugging lines are permitted only after the OBJECT-COMPUTER paragraph.
The COBOL compilation unit must be syntactically correct, regardless of whether or not the debugging lines are taken into account.
Debugging lines are only permitted in fixed format.