Ch 13. Debug Module [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
Chapter 13 Debug Module
The Debug Module provides a means by which you can describe a debugging
algorithm including the conditions under which procedures are to be
monitored during the execution of the object program.
NOTE With the exception of debug lines, this module is an obsolete
feature of the 1985 ANSI COBOL standard.
The decisions of what to monitor and what information to display on the
output device are explicitly yours. The COBOL debug facility simply
provides a convenient access to pertinent information.
The HP COBOL II Debug Module implements the level 1 characteristics of
the ANSI standard Debug Module. It provides a basic debugging
capability, including the ability to specify: (a) selective or full
procedure monitoring, and (b) optionally compiled debugging statements.
The features of the COBOL language that support the Debug Module are:
1. A compile-time switch: WITH DEBUGGING MODE
The WITH DEBUGGING MODE clause is written as part of the
SOURCE-COMPUTER paragraph. It serves as a compile-time switch
over the debugging statements written in the program.
When the WITH DEBUGGING MODE clause is specified in a program, all
debugging sections and all debugging lines are compiled as
specified in that section of the document. When the WITH
DEBUGGING MODE clause is not specified, all debugging lines and
all debugging sections are compiled as if they were comment lines.
2. An object-time switch: USE FOR DEBUGGING
This switch dynamically activates the debugging code inserted by
the compiler. This switch cannot be addressed in the program. It
is controlled outside the COBOL environment. If the switch is
"on", all the effects of the debugging language written in the
source program are permitted. If the switch is "off", all the
effects of the USE FOR DEBUGGING statement, are inhibited.
Recompilation of the source program is required to provide or take
away this facility.
For information on setting the object-time debug module switch,
refer to "System Dependencies" in Appendix H .
This object-time switch has no effect on the execution of the
object program if the WITH DEBUGGING MODE clause was not specified
in the source program at compile time.
_________________________________________________________________
NOTE The object-time switch does not control the debugging lines.
Recompilation without the "WITH DEBUGGING MODE" clause is
necessary to disable the debugging lines.
_________________________________________________________________
3. A special register: DEBUG-ITEM
The reserved word DEBUG-ITEM is the name for a special register
generated automatically by the compiler. Only one DEBUG-ITEM is
allocated per program. The names of the subordinate data items in
DEBUG-ITEM are also reserved words.
4. Debugging lines
A debugging line is any line with a "D" in column 7. These lines
are added anywhere in the program after the OBJECT-COMPUTER
paragraph and are used strictly for debugging purposes. Such
lines make use of common COBOL statements such as "DISPLAY" in
order to monitor program status.
The contents of a debugging line must be totally independent of
the program itself, so that a syntactically correct program is
formed either with or without the debugging lines.
MPE/iX 5.0 Documentation