This article explains how to find the line of code that matches the PC to an RTS error.
Problem:
When running a program, the following RTS error occurs and we would like to know how to find out the source line from pc=2007.
Execution error : file 'mr01.int'
error code: 166, pc=2007, call=218, seg=0
166 Recursive COBOL CALL is illegal
Resolution:
To find the line of code at address 2007, compile your program with -C REF and -C LIST"".
Here's another example:
Execution error : file '/home2/support/juj/tmp/mydem.int'
error code: 153, pc=3D, call=1, seg=0
153 Subscript out of range
tsron:/home2/support/juj/tmp > cob -C'ref list""' mydem.cbl
tsron:/home2/support/juj/tmp > cat *.lst
* Micro Focus Server Express V2.2 revision 000 30-Oct-03 13:06 Page 1
* mydem.cbl
1 working-storage section.
2 01 ws-a pic x occurs 10.
3 01 w-idx pic 9.
4 procedure division.
5 display "here we go"
6 move 0 to w-idx
7 display ws-a(w-idx)
8 display "error forced"
9 stop run.
* Micro Focus Server Express V2.2 revision 000 Compiler
* Copyright (C) 1984-2002 Micro Focus International Ltd. URN RXCAI/AA0/00000Q
* REF GNR-166060000AD
* Total Messages: 0
* Data: 484 Code: 97
*
Address Line No Address Line No Address Line No Address Line No
00000024 5 00000032 6 00000038 7 00000043 8 00000053 9
--------------------------------------------------------------------
PC address 3D (hex) is at line 7 (which runs from hex 38 to hex 42)