Generating a COBOL run-time paragraph trace

To generate a trace showing the names of paragraphs through which execution has passed, the z/OS® Debugger commands shown in the following example can be used. You can either enter the commands from the z/OS Debugger command line or place the commands in a file or data set.

Example: sample COBOL program for debugging

Assume you have a PDS member, USERID.DT.COMMANDS(COBCALC2), that contains the following z/OS Debugger commands.
* COMMANDS IN A COBOL USE FILE MUST BE CODED IN COLUMNS 8-72.
* IF NECESSARY, COMMANDS CAN BE CONTINUED BY CODING A '-' IN
* COLUMN 7 OF THE CONTINUATION LINE.
 AT GLOBAL LABEL PERFORM;
   LIST LINES %LINE;
   GO;
 END-PERFORM;
When z/OS Debugger initially displays your program, enter the following command:
USE USERID.DT.COMMANDS(COBCALC2)
After executing the USE file, you can run COBCALC and the following trace (or similar) is displayed in the Log window:
      42       ACCEPT-INPUT.

      59       CALCULATE-LOAN.

      42       ACCEPT-INPUT.

      66       CALCULATE-VALUE.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      42       ACCEPT-INPUT.

      66       CALCULATE-VALUE.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      64       GET-AMOUNTS.

      42       ACCEPT-INPUT.