Generating information about procedures
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:
- How many times a
PERFORMstatement runs, and thus whether a particular routine is being used and whether the control structure is correct - How many times a loop runs, and thus whether the loop is executing and whether the number for the loop is accurate
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:
- Only in a
DECLARATIVESsection. - Following the header
USE FOR DEBUGGING. - Only in the outermost program; they are not valid in nested programs. Debugging statements are also never triggered by procedures that are contained in nested programs.
To
use debugging statements in your program, you must include the WITH
DEBUGGING MODE clause and use the DEBUG runtime
option.
Options restrictions:
- You cannot use the
USE FOR DEBUGGINGdeclarative in a program that you compile with theTHREADoption.
SOURCE-COMPUTER paragraph (Enterprise COBOL for z/OS® Language Reference)
Debugging lines (Enterprise COBOL for z/OS Language Reference)
Debugging sections (Enterprise COBOL for z/OS Language Reference)
DEBUGGING declarative (Enterprise COBOL for z/OS Language Reference)