Previous Topic Next topic Print topic


Debugging Example

The following listing shows the listing information from the file created when compiling the example programs Buggy and Bug. The listing file produced contains more information than is shown here, but has been edited to make viewing this information easier.

1 program-id. "buggy".   0
2 working-storage section.  160 
3 01 a pic 9(6).     160 
4 procedure division.<N>  0 
5     move 999999 to a   29 
6     call "bug" using a  33 
7     stop run.     3D 
8     end program "buggy".  3E 
9         47
10 program-id. "bug".   47
11 working-storage section.  160
12 01 b pic x(20).    160
13 01 c pic x.     178
14 linkage section.    17C
15 01 a pic 9(6).    0
16 procedure division using a. 0
17     move "1" to b(a:1)  29
18     exit program.   30
19         31

An alternative method to using the LIST () and REF directives is to debug the program using the debugger. Use the Run operation of the debugger to execute your program at full speed to the location that causes the protection violation. At this point, RTS error 114 ("Attempt to access item beyond bounds of memory") is issued, and the debugger regains control on the line of source that caused the protection violation.

Previous Topic Next topic Print topic