The following example illustrates an error caused by an array subscript value outside the
declared range. In this example, the declared array value is 10. This routine was compiled with the
options LIST, TEST, GOSTMT, and MAP. It was run with the TERMTHDACT(TRACE) option to generate a
traceback for the condition.
Figure 1. Example of moving a value outside an array range
5688-235 IBM PL/I for MVS & VM Ver 1 Rel 1 Mod 1 27 FEB 07 11:45:18 PAGE 1
OPTIONS SPECIFIED
*PROCESS GOSTMT LIST S STG TEST MAP NOOPTIONS;
5688-235 IBM PL/I for MVS & VM EXAMPLE: PROC OPTIONS(MAIN); PAGE 2
SOURCE LISTING
STMT
1 EXAMPLE: PROC OPTIONS(MAIN);
2 DCL Array(10) Fixed bin(31);
3 DCL (I,Array_End) Fixed bin(31);
4 On error
Begin;
5 On error system;
6 Call plidump('tbnfs','Plidump called from error On-unit');
7 End;
8 (subrg): /* Enable subscriptrange condition */
Labl1: Begin;
9 Array_End = 20;
10 Do I = 1 to Array_End; /* Loop to initialize array */
11 Array(I) = 2; /* Set array elements to 2 */
12 End;
13 End Labl1;
14 End Example;
⋮
5688-235 IBM PL/I for MVS & VM EXAMPLE: PROC OPTIONS(MAIN); PAGE 5
VARIABLE STORAGE MAP
IDENTIFIER LEVEL OFFSET (HEX) CLASS BLOCK
I 1 200 C8 AUTO EXAMPLE
ARRAY_END 1 204 CC AUTO EXAMPLE
ARRAY 1 208 D0 AUTO EXAMPLE
5688-235 IBM PL/I for MVS & VM EXAMPLE: PROC OPTIONS(MAIN); PAGE 6
The following examples show sections of the dump generated by a call to PLIDUMP.
Figure 2. Sections of the Language Environment dump (Part 1 of 2)
CEE3DMP V1 R9.0: Plidump called from error On-unit 02/27/07 11:45:20 AM Page: 1
ASID: 003E Job ID: JOB21950 Job name: LEDGSMP1 Step name: GO UserID: HEALY
CEE3845I CEEDUMP Processing started.
PLIDUMP was called from statement number 6 at offset +000000D6 from ERR ON-unit with entry address 20900C58
Information for enclave EXAMPLE
Information for thread 8000000000000000
Traceback:
DSA Entry E Offset Statement Load Mod Program Unit Service Status
1 CEEKKMRA +0000081C CEEPLPKA CEEKKMRA D1908 Call
2 IBMRKDM +000000C2 IBMREV10 IBMRKDM Call
3 ERR ON-unit+000000D6 6 EXAMPLE EXAMPLE Call
4 IBMRERPL +0000065A IBMRLIB1 IBMRERPL Call
5 CEEEV010 +0000013A IBMREV10 CEEEV010 Call
6 CEEHDSP +000017D0 CEEPLPKA CEEHDSP D1908 Call
7 IBMRERRI +0000045A IBMRLIB1 IBMRERRI Exception
8 LABL1: BEGIN+000000BE 11 EXAMPLE EXAMPLE Call
9 EXAMPLE +000000C8 8 EXAMPLE EXAMPLE Call
10 IBMRPMIA +0000051E IBMRLIB1 IBMRPMIA Call
11 CEEEV010 +00000310 IBMREV10 CEEEV010 Call
12 CEEBBEXT +000001B6 CEEPLPKA CEEBBEXT D1908 Call
DSA DSA Addr E Addr PU Addr PU Offset Comp Date Compile Attributes
1 20B45B88 209F0420 209F0420 +0000081C 20061214 CEL
2 00025670 20B1C0A0 20B1C0A0 +000000C2 ******** OS PL/I
3 20B45A88 20900C58 20900B70 +000001BE ******** OS PL/I
4 20B45850 00019F50 00019F50 +0000065A 20061213 LIBRARY
5 20B457C8 20B02998 20B02998 +0000013A 20061213 LIBRARY
6 20B426A8 209BF068 209BF068 +000017D0 20061215 CEL
7 20B42500 0001B328 0001B328 +0000045A 20061213 LIBRARY
8 20B42430 20900D48 20900B70 +00000296 ******** OS PL/I
9 20B42330 20900B78 20900B70 +000000D0 ******** OS PL/I
10 20B42178 000201D0 000201D0 +0000051E 20061214 LIBRARY
11 20B420F0 20B02998 20B02998 +00000310 20061213 LIBRARY
12 20B42030 2098DDB8 2098DDB8 +000001B6 20061215 CEL
Condition Information for Active Routines
Condition Information for IBMRERRI (DSA address 20B42500)
CIB Address: 20B42FC8
Current Condition:
IBM0281S A prior condition was promoted to the ERROR condition.
Original Condition:
IBM0421S ONCODE=520 The SUBSCRIPTRANGE condition was raised.
Location:
Program Unit: IBMRERRI Entry: IBMRERRI Statement: Offset: +0000045A
Storage dump near condition, beginning at location: 0001B772
+000000 0001B772 5050D080 58A0C2B8 58F0A01C 4110D080 05EF9108 404F4710 B4709104 404F47E0 |&&....B..0........j. |....j. |..|
Control Blocks for Active Routines:
⋮
DSA for CEEHDSP: 20B426A8
+000000 FLAGS.... 0808 member... CEE1 BKC...... 20B42500 FWC...... 20B457C8 R14...... A09C083A
+000010 R15...... A0B02998 R0....... 00000020 R1....... 2090B2E8 R2....... 20B42FC8 R3....... 20B42330
+000024 R4....... 209C3C94 R5....... FFFFFF20 R6....... 00000001 R7....... 00000007 R8....... A09C0542
+000038 R9....... 20B446A6 R10...... 20B436A7 R11...... A09BF068 R12...... 2090E9C0 reserved. 00025670
+00004C NAB...... 20B457C8 PNAB..... 00000000 reserved. 00000000 20B4271C
+000064 reserved. 00000000 reserved. 00000000 MODE..... 00000000 reserved. 00000000
+000078 reserved. 00000000 reserved. 00000000
DSA for IBMRERRI: 20B42500
+000000 FLAGS.... 8800 member... 0000 BKC...... 20B42430 FWC...... 20B425C0 R14...... 8001B784
+000010 R15...... A09D0B48 R0....... 0000000B R1....... 20B42580 R2....... 0000000A R3....... 20900EB0
+000024 R4....... 00025470 R5....... 000254C4 R6....... 20B42330 R7....... 20B42330 R8....... 00000028
+000038 R9....... 00000008 R10...... A09104D0 R11...... 0001B328 R12...... 2090E9C0 reserved. 00025290
+00004C NAB...... 20B425C0 PNAB..... 008FF4E8 reserved. 2090D658 20AF22BC
+000064 reserved. 2090E9C0 reserved. 20B420F0 MODE..... 20B2FA47 reserved. A09104D0
+000078 reserved. 00000000 reserved. 20B42838
Figure 3. Sections of the Language Environment dump (Part 2 of 2)
CIB for IBMRERRI: 20B42FC8
+000000 20B42FC8 C3C9C240 00000000 00000000 010C0004 00000000 00000000 00030119 59C9C2D4 |CIB .........................IBM|
+000020 20B42FE8 00000000 20B430D8 000301A5 59C9C2D4 00000001 00000015 20B42330 A0B02998 |.......Q...v.IBM...............q|
+000040 20B43008 00000000 20B42500 8001B784 2090B6F0 0000000A 20B42430 00000000 00000000 |...........d...0................|
+000060 20B43028 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 |................................|
+000080 20B43048 - +00009F 20B43067 same as above
+0000A0 20B43068 00000000 00000000 00000000 00000000 06230000 00000FC6 00000001 00000000 |.......................F........|
+0000C0 20B43088 00000000 00000000 20B42430 20B42500 0001B782 00000000 00000000 00000001 |...................b............|
+0000E0 20B430A8 20B42330 0000000A 00000064 00000000 FFFFFFFC 00000000 00000000 00000000 |................................|
+000100 20B430C8 00000000 2090B908 00000000 00000000 E9D4C3C8 02000001 0000000B 20B42580 |................ZMCH............|
Dynamic save area (IBMRERRI): 20B42500
+000000 20B42500 88000000 20B42430 20B425C0 8001B784 A09D0B48 0000000B 20B42580 0000000A |h..............d................|
+000020 20B42520 20900EB0 00025470 000254C4 20B42330 20B42330 00000028 00000008 A09104D0 |...........D.................j..|
+000040 20B42540 0001B328 2090E9C0 00025290 20B425C0 008FF4E8 2090D658 00000000 20AF22BC |......Z...........4Y..O.........|
+000060 20B42560 A0997C20 2090E9C0 20B420F0 20B2FA47 A09104D0 2090E9C0 00000000 20B42838 |.r@...Z....0.....j....Z.........|
+000080 20B42580 000254C4 00000000 00000000 00000000 00000000 00000000 00000000 00000000 |...D............................|
+0000A0 20B425A0 16000000 20909DB0 00000000 80010000 00000000 209D4520 20B2F7B4 2090E200 |..........................7...S.|
DSA for LABL1: BEGIN: 20B42430
+000000 FLAGS.... 8425 member... 0000 BKC...... 20B42330 FWC...... 20B42500 R14...... A0900E08
+000010 R15...... 0001B328 R0....... 0000000B R1....... 20900EB0 R2....... A0900DBE R3....... 20900E40
+000024 R4....... 00000001 R5....... 20B42330 R6....... 20B42330 R7....... 20B42330 R8....... 00000028
+000038 R9....... 00000008 R10...... 20B420B0 R11...... 2090102C R12...... 2090E9C0 reserved. 00025290
+00004C NAB...... 20B42500 PNAB..... 20B42500 reserved. 91A091A0 00000000
+000064 reserved. 00000000 reserved. 00000000 MODE..... 00000000 reserved. 00000000
+000078 reserved. 00000000 reserved. 20B42030
Dynamic save area (LABL1: BEGIN): 20B42430
+000000 20B42430 84250000 20B42330 20B42500 A0900E08 0001B328 0000000B 20900EB0 A0900DBE |d...............................|
+000020 20B42450 20900E40 00000001 20B42330 20B42330 20B42330 00000028 00000008 20B420B0 |... ............................|
+000040 20B42470 2090102C 2090E9C0 00025290 20B42500 20B42500 91A091A0 20B42330 00000000 |......Z.............j.j.........|
+000060 20B42490 00000000 00000000 00000000 00000000 00000000 00000200 00000000 20B42030 |................................|
+000080 20B424B0 20B42530 A0B02CEC 20B2EA48 00000800 20B420F0 20B420F0 A0B02998 20901340 |...................0...0...q... |
+0000A0 20B424D0 2090E880 0000000A 00000000 00000000 20AF2CD6 00000027 A0AF0CD8 2090E9C0 |..Y................O.......Q..Z.|
+0000C0 20B424F0 20B42330 20B42618 00000014 00000000 88000000 20B42430 20B425C0 8001B784 |................h..............d|
DSA for EXAMPLE: 20B42330
+000000 FLAGS.... C025 member... 0000 BKC...... 20B42178 FWC...... 00000000 R14...... A0900C42
+000010 R15...... 20900D48 R0....... 20B42430 R1....... 20B42330 R2....... A0900C30 R3....... 20900E40
+000024 R4....... 00000001 R5....... 20B42330 R6....... 20B42400 R7....... 00000005 R8....... 20900EF8
+000038 R9....... 00000008 R10...... 20B420B0 R11...... 2090102C R12...... 2090E9C0 reserved. 00025290
+00004C NAB...... 20B42430 PNAB..... 20B42430 reserved. 91E091A0 20900EF8
+000064 reserved. 00000000 reserved. 00000000 MODE..... 00000000 reserved. 20B423E8
+000078 reserved. 00000000 reserved. 00000000
Dynamic save area (EXAMPLE): 20B42330
+000000 20B42330 C0250000 20B42178 00000000 A0900C42 20900D48 20B42430 20B42330 A0900C30 |................................|
+000020 20B42350 20900E40 00000001 20B42330 20B42400 00000005 20900EF8 00000008 20B420B0 |... ...................8........|
+000040 20B42370 2090102C 2090E9C0 00025290 20B42430 20B42430 91E091A0 00000000 20900EF8 |......Z.............j.j........8|
+000060 20B42390 00000000 00000000 00000000 00000000 20B423E8 00000200 00000000 00000000 |...................Y............|
+000080 20B423B0 20B42124 20B42128 20B4212C 20B42130 20B42138 20B42134 20B4213C 00000000 |................................|
+0000A0 20B423D0 00000000 00000000 00000000 00000000 00000000 00000000 0C010000 00000000 |................................|
+0000C0 20B423F0 20B42400 20900E94 0000000B 00000014 00000002 00000002 00000002 00000002 |.......m........................|
+0000E0 20B42410 00000002 00000002 00000002 00000002 00000002 00000002 00000000 00000000 |................................|
⋮
To debug this routine, use the following steps:
In the dump, PLIDUMP was called by the ERROR ON-unit in statement 6. The traceback information
in the dump shows that the exception occurred following statement 11.
Locate the Original Condition message in the Condition Information for Active Routines section
of the dump. The message is IBM0421S ONCODE=520 The SUBSCRIPTRANGE condition was
raised.
This message indicates that the exception occurred when an array
element value exceeded the subscript range value (in this case, 10). For more information about this
message, see z/OS Language Environment Runtime Messages .
Locate statement 9 in the routine in Figure 1 . The
instruction is Array_End = 20
. This statement assigns a 20 value to the variable
Array_End
.
Statement 10 begins the DO-loop instruction Do I = 1 to Array_End
. Since the
previous instruction (statement 9) specified that Array_End = 20
, the loop in
statement 10 should run until I
reaches a 20 value. The instruction in statement
2, however, declared a 10 value for the array range. Therefore, when the I value reached 11, the
SUBSCRIPTRANGE condition was raised.
The following steps provide another method for finding the value that raised the SUBSCRIPTRANGE
condition.
Locate the offset of variable I in the variable storage map in Figure 1 . Use this offset to find the I value at the time of
the dump. In this example, the offset is X'C8'.
Now, find offset X'C8' from the start of the stack frame for the entry EXAMPLE in Figure 2 . The block located at this offset contains the
value that exceeded the array range, X'B' or 11.