Tracing the run-time path for COBOL code compiled with TEST
To trace a program showing the entry and exit points without requiring
any changes to the program, place the following z/OS® Debugger commands
in a file or data set and USE them when z/OS Debugger initially
displays your program. Assuming you have a PDS member, USERID.DT.COMMANDS(COBCALC),
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.
01 LEVEL PIC 99 USAGE COMP;
MOVE 1 TO LEVEL;
AT ENTRY * PERFORM;
COMPUTE LEVEL = LEVEL + 1;
LIST ( "Entry:", LEVEL, %CU);
GO;
END-PERFORM;
AT EXIT * PERFORM;
LIST ( "Exit:", LEVEL);
COMPUTE LEVEL = LEVEL - 1;
GO;
END-PERFORM;
You can use this file as the source of
commands to z/OS Debugger by
entering the following command: USE USERID.DT.COMMANDS(COBCALC)
If, after executing the USE file, you run COBCALC, the
following trace (or similar) is displayed in the Log window:
ENTRY:
LEVEL = 00002
%CU = COBCALC
ENTRY:
LEVEL = 00003
%CU = COBLOAN
EXIT:
LEVEL = 00003
ENTRY:
LEVEL = 00003
%CU = COBVALU
EXIT:
LEVEL = 00003
ENTRY:
LEVEL = 00003
%CU = COBVALU
EXIT:
LEVEL = 00003
EXIT:
LEVEL = 00002
If you do not want to create the USE file,
you can enter the commands through the command line, and the same
effect is achieved.