Debugging sections
Debugging sections are permitted only in the outermost program; they are not valid in nested programs. Debugging sections are never triggered by procedures contained in nested programs.
Debugging sections are declarative procedures. Declarative procedures are described under USE statement. A debugging section can be called, for example, by a PERFORM statement that causes repeated execution of a procedure. Any associated procedure-name debugging declarative section is executed once for each repetition.
A debugging section executes only if both the compile-time switch and the object-time switch are activated.
The debug feature recognizes each separate occurrence of an imperative statement within an imperative statement as the beginning of a separate statement.
You cannot refer to a procedure defined within a debugging section from a statement outside of the debugging section.
References to the DEBUG-ITEM special register can be made only from within a debugging declarative procedure.