The TRACE function writes the statement numbers of COBOL statements that were executed, up to abnormal termination, as trace information.
Number of Trace Information Items
When compiler option TRACE is specified without specifying the number of information items at compile time, up to 200 trace information items are produced.
If one run unit contains two or more COBOL programs which had the TRACE option specified, the number specified with the TRACE option for the program that is activated first will be used.
To change the number of trace items to be generated, use the execution-time option r. The TRACE function can also be suppressed by specifying execution time option nor. Refer to "Format of Runtime Options" in the "NetCOBOL User's Guide" for the detail.
Note
Zero cannot be specified for the number of trace information items.
Trace Information Storage Destination
Trace information is stored in files specified in the environment variable information @CBR_TRACE_FILE. Refer to "@CBR_TRACE_FILE (Specify the trace information output file)" in the "NetCOBOL User’s Guide".
If the environment variable information @CBR_TRACE_FILE is not specified, trace information is stored in files named after the executable file with the extensions TRC and TRO.
The trace information is always stored in a file with the extension TRC. When the number of stored information items reaches the specified count at compilation or execution, the contents of the file with the extension TRC are converted to a file with the extension TRO.
Examples of trace information storage file names that are assumed when the environment variable information @CBR_TRACE_FILE is specified and when it is not specified are provided below.
Example
If C:\PROG1.TRC is specified in the environment variable information @CBR_TRACE_FILE
Trace information storage destination (current information): C:\PROG1.TRC
Trace information storage destination (information on the previous generation): C:\PROG1.TRO
If the environment variable information @CBR_TRACE_FILE is not specified
Executable program storage destination: C:\PROG2.EXE
Trace information storage destination (current information): C:\PROG2.TRC
Trace information storage destination (information on the previous generation): C:\PROG2.TRO
Output Format of Trace Information
The output format of trace information is shown below.
NetCOBOL DEBUG INFORMATION DATE 2007-07-04 TIME 11:39:22 PID=00000123 (1) TRACE INFORMATION (2) (3) (4) (5) (6) 1 External-program-name [Internal-program-name] Compilation-date TID=00000099 2 (7) 1100.1 TID=00000099 3 1200.1 TID=00000099 4 1300.1 TID=00000099 5 (8) 1300.2 (9) (5) 6 Class-name [Method-name] Compilation-date TID=00000099 7 2100.1 TID=00000099 8 2200.1 TID=00000099 9 JMPnnnnI-x xxxxxxxxx xx xxxxxxxxx. (10) 10 THE INTERRUPTION WAS OCCURRED.PID=00000123,... (11) 11 EXIT-THREAD TID=00000099 (12) :
[1] Process ID (hexadecimal notation): The process identification number assigned by the operating system when the program was run.
[2] Trace information sequence number (decimal notation): The value is incremented whenever trace information output is displayed. Since trace information is overwritten to two files alternately, this value indicates the sequence number of the information from the start of the program.
[3] External program name: An external program name is output.
[4] Internal program name: The name is the output when an internal program executes. This information is not displayed for external programs.
[5] Compilation date: When an external program executes, the compilation date and time of the program are output.
[6] Thread ID (hexadecimal notation): The thread identification number assigned by the operating system when the program was run.
[7] Statement or procedure-name/paragraph-name that was executed: The statement number of the statement, procedure name, or paragraph name that was executed is the output.
[8] Class-name: A class-name is listed here. If an inheriting method is executed, the class-name of the parent that has defined the procedures for the method will be listed.
[9] Method-name: method-name is listed.
[10] Execution-time message: If messages are generated by the runtime system during execution of the program, those messages will be shown here.
[11] Exception report message: This message is generated when an exception (such as a reference to an illegal address) has been reported by the operating system. The message is not generated when the program has ended normally or when a U-level error has occurred.
[12] Thread end report message: This message is generated when the program terminates normally and the thread has ended.
Trace Information File
The trace information file of each process is output. In order to prevent overwriting the results of each run with trace, change the name of the trace output file each time you execute the same program.
When the trace information file name of each process is changed, the environment variable information @CBR_TRACE_PROCESS_MODE is specified.
Refer to "@CBR_TRACE_PROCESS_MODE (Unique file name for each Trace file output)" in the "NetCOBOL User's Guide" for the detail.
An example of the file name when @CBR_TRACE_PROCESS_MODE is specified is shown below.
Example
When the environment variable information @CBR_TRACE_PROCESS_MODE is specified
Executable file name:SAMPLE.EXE Process-ID:00000EC4 Execution date:12/1/2010 Execution time:10:48:50
The newest trace information file name is :
SAMPLE-00000EC4_20100112_104850.TRC
The older trace information file name is :
SAMPLE-00000EC4_20100112_104850.TRO