COBOL Manual for TNS/E Programs (H06.03+)
Executing and Debugging HP COBOL Programs
HP COBOL Manual for TNS/E Programs—520347-003
25-14
Getting a Program to Enter Debugging Mode
A run-time diagnostic message identifies the error, the process in which the error
occurred, and the loadfile from which the process was loaded. The error number and
format of a run-time diagnostic message depend on the run-time environment. For
details, see Section 48, Run-Time Diagnostic Messages.
One category of run-time diagnostic messages is not reported to the default output
device: input-output exceptions with I-O status codes less than “30” that your program
handles with its own error-handling procedures.
Error-Handling Procedures
In your HP COBOL program, you can define error-handling procedures with USE
AFTER EXCEPTION statements. When a file system error occurs, control passes to a
USE AFTER EXCEPTION statement, which can access two values to determine what
action to take. The first value is the I-O status code, which identifies the error; the
second value is that of the special register GUARDIAN-ERR, which identifies the
cause of the error.
One I-O error can have several possible causes; therefore, one I-O code status value
can be associated with several GUARDIAN-ERR values. For example, a WRITE
statement error (I-O code status value “24”) can be caused by a relative key that is out
of bounds (GUARDIAN-ERR value 23), a full file (GUARDIAN-ERR value 45), or an
invalid key (GUARDIAN-ERR value 46). The USE AFTER EXCEPTION statement can
interpret the value of GUARDIAN-ERR and act accordingly.
After a USE AFTER EXCEPTION statement executes, it returns control to the routine
that called it, except when the I-O status code is “4x ” or “90,” in which case the
process terminates abnormally.
For more information about the USE AFTER EXCEPTION statement and diagnosing
input-output errors, see USE AFTER EXCEPTION.
Getting a Program to Enter Debugging Mode
You can get a program to enter debugging mode (that is, to enter the debugger for
which you compiled the program) at any of these times:
•
Before Execution
•
During execution:
°
Programmatically
°
Forcefully
For information on specific debuggers, see Section 15, Debugging Tools.










