COBOL Manual for TNS and TNS/R Programs

Debugging Tools
HP COBOL Manual for TNS and TNS/R Programs522555-006
15-2
Standard COBOL Debugging Tools
Debugging Declaratives
Debugging declaratives are sections in the Declaratives Portion of the Procedure
Division. A debugging declarative consists of a USE DEBUGGING statement followed
by a procedure to be executed under the circumstances specified in the USE
DEBUGGING statement.
The circumstances under which a procedure in a debugging declarative can be called
are:
A particular procedure call
Any procedure call
Debugging declaratives are only executed if you execute a PARAM DEBUG ON
command before executing your program (see Enabling Debugging Declaratives).
When a program uses debugging declaratives, it can access the special register
DEBUG-ITEM. Whenever control passes to a debugging declarative, the contents of
DEBUG-ITEM reflect the status of the item that caused the declarative to be called.
DEBUG-ITEM is a data structure that is defined as in Figure 15-1.
Note. The 1985 COBOL standard classifies USE DEBUGGING as obsolete, so you are
advised not to use it, even in TNS HP COBOL programs. The NMCOBOL compiler does not
recognize it.
Figure 15-1. Definition of the DEBUG-ITEM Special Register
01 DEBUG-ITEM.
05 DEBUG-LINE PIC X(6).
05 FILLER PIC X VALUE SPACE.
05 DEBUG-NAME PIC X(30).
05 FILLER PIC X VALUE SPACE.
05 DEBUG-SUB-1 PIC S9999 SIGN IS LEADING
SEPARATE CHARACTER.
05 FILLER PIC X VALUE SPACE.
05 DEBUG-SUB-2 PIC S9999 SIGN IS LEADING
SEPARATE CHARACTER.
05 FILLER PIC X VALUE SPACE.
05 DEBUG-SUB-3 PIC S9999 SIGN IS LEADING
SEPARATE CHARACTER.
05 FILLER PIC X VALUE SPACE.
05 DEBUG-CONTENTS PIC X(n).