Generate information about your program or test case and how it is running by coding the USE FOR DEBUGGING declarative. This declarative lets you include statements in the program and indicate when they should be performed when you run your program.
For example, to determine how many times a procedure is run, you could include a debugging procedure in the USE FOR DEBUGGING declarative and use a counter to keep track of the number of times that control passes to that procedure. You can use the counter technique to check items such as these:
You can use debugging lines or debugging statements or both in your program.
Debugging lines are statements that are identified by a D in column 7. To make debugging lines in your program active, code the WITH DEBUGGING MODE clause on the SOURCE-COMPUTER line in the ENVIRONMENT DIVISION. Otherwise debugging lines are treated as comments.
Debugging statements are the statements that are coded in the DECLARATIVES section of the PROCEDURE DIVISION. Code each USE FOR DEBUGGING declarative in a separate section. Code the debugging statements as follows:
To use debugging statements in your program, you must include the WITH DEBUGGING MODE clause and use the DEBUG runtime option. However, you cannot use the USE FOR DEBUGGING declarative in a program that you compile with the THREAD option.
The WITH DEBUGGING MODE clause and the TEST compiler option are mutually exclusive. If both are present, the WITH DEBUGGING MODE clause takes precedence.
related references
SOURCE-COMPUTER paragraph
(COBOL for Windows Language Reference)
Debugging lines
(COBOL for Windows Language Reference)
Debugging sections
(COBOL for Windows Language Reference)
DEBUGGING declarative
(COBOL for Windows Language Reference)