Six types of debugging functions are available for COBOL:
Checking the referencing of an incorrect area, data exceptions, and parameters (CHECK function)
Tracing executed COBOL statements (TRACE function)
Reporting the execution count for each statement sequentially, as well as by verb, along with percentage of these counts (COUNT function).
Checking the runtime system area (Memory Check function)
Generating diagnostic reports and dump on application errors and runtime messages (COBOL Error Report).
Using the object program listing to identify the statement that terminated abnormally (debugging using an object program listing)
To use the debugging function, specify the compiler option for each desired debugging function at the compilation of the COBOL program, and specify the environment to operate the debugging function at the execution of the program.
Table 5.1 Outline of the debugging functions and compiler optionsFunction Name | Outline | Compiler Option |
---|
CHECK function | The following items are checked. Whether the subscript or the index addresses an area outside of the range of a table when that table is referenced Whether the reference modified exceeds the data length at reference modification Whether the contents of the object word are correct when the data containing the OCCURS DEPENDING ON clause is referenced Whether the numeric item contains a value of the type that is specified by the attribute. Whether the divisor in division is not zero. Whether, in an invoked method, the number of parameters and attributes for a calling method match those for a called method. Whether, in an invoked program, the calling conventions of a calling program match those of a called program. Whether, the number of parameters and length of the CALL statements match those of a called program.
Purpose To prevent an operation error of the program due to a memory reference error To prevent erroneous numbers from causing a program to behave unexpectedly To prevent invalid parameters from causing a program to behave unexpectedly To prevent different calling conventions from causing a program to behave unexpectedly.
| CHECK |
TRACE function | The following types of information are output: Tracing result of executed statements Line number and verb number of the statement that was executed at abnormal termination Program name that contains the statements that were executed and program attribute information Message output during execution
Purpose To ascertain at which statement abnormal termination occurred To ascertain the path of the statements that were executed up to abnormal termination To check the message output during execution
| TRACE |
COUNT function | This function reports: The execution count for each statement in your program, sequentially, along with the percentage of this execution count vs. the total execution count for all the statements. The execution count by verb that appears in your program, along with the percentage of this count vs. the total execution count for all the statements.
Purpose | COUNT |
Memory check function | The following items are checked. Purpose | - |
COBOL Error Report | This function reports the following information: Error type (Exception code or runtime message) Problem location (Module name, program name, source file name, line number) Calling path System information Environment variable Runtime environment information Process list Module list Thread information
Moreover, the dump is output. Purpose To identify which error has occurred and in which statement To identify the calling path for the programs run until errors occurred To identify the status of applications or the computer in effect when errors occurred
| TEST |
Debugging using Compiler Listings | The following information is output for each object program. Object relative offset Object code in machine language Procedure name and procedure number Assembler instruction Verb name and line number Area name Defined word written in the COBOL program
Purpose | LIST PRINT SOURCE COPY MAP |
Note
You cannot use the TRACE and COUNT functions at the same time.