Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/35269

From BetaArchive Wiki

Tracing Program Execution with TRACE Directive and READY TRACE

PSS ID Number: Q35269 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, version 3.0

Summary: During program execution, the name of the executed paragraphs may be printed out to the screen or printer. The TRACE feature is useful for tracing the execution path of the program. The following must be done to turn on the tracing feature: 1. The TRACE directive needs to be added in one of three places: a. In the COBOL.DIR file b. On the command line during compilation c. In the program code using the $SET command 2. Tracing may be turned on and off using the commands READY TRACE and RESET TRACE. These commands are used in the PROCEDURE DIVISION of the COBOL program like any other COBOL statement. The READY TRACE command turns the tracing feature on, while the RESET TRACE command turns the tracing feature off.

More Information: The following example program demonstrates the use of the READY TRACE and RESET TRACE commands: $SET TRACE IDENTIFICATION DIVISION. PROGRAM-ID. TRACEEX. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 EXTRA-COMMA PIC 9(6) VALUE 0. SCREEN SECTION. 01 DISPLAY-SCREEN. 05 LINE 1 COLUMN 1 PIC ZZZ,ZZ9 FROM EXTRA-COMMA. PROCEDURE DIVISION. READY TRACE. P00-MAIN-ROUTINE. DISPLAY DISPLAY-SCREEN. RESET TRACE. PERFORM P200-GET-INPUT UNTIL EXTRA-COMMA > 100. READY TRACE. PERFORM P300-DISPLAY-INPUT. STOP RUN. P200-GET-INPUT. ACCEPT EXTRA-COMMA AT 2001. P300-DISPLAY-INPUT. DISPLAY DISPLAY-SCREEN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.