I have an RPGLE program that occasional fails because of a MCH0601
pointer error. How do I determine what is causing this error? I've
double and triple checked the program parameters size and everything is
okay there. Below is the message I'm receiving:
---
Message . . . . : Space offset X'00041020' or X'0000000000000000' is
outside current limit for object DWEM D_MIRROR 061387.
Cause . . . . . : A program tried to set a space pointer or use
storage outside a space, or tried to use an unallocated page in
teraspace. The space class is X'04'. The space class designates the
type of space: 00-primary associated space (includes space objects).
01-secondary associated space 0.
02-implicit process space for automatic storage. 03-implicit process
space for static storage in activation group mark X'00000000'.
04-implicit process
space for heap identifier X'00000000' in activation group mark
X'00000000'. 05-constant space. 06-space for handle-based heap
identifier X'00000000'.
07-teraspace offset X'0000000000000000'. 08-teraspace for OS/400 PASE
memory address X'0000000000000000'. Offset X'00041020' only applies to
storage outside teraspace. X'8000000000000000CFDFBE9158001000' is a
pointer to the teraspace page or the start of the implicit process
space for the
allocation.
---
Shane
you get this error when the value you are adding to a pointer causes
the pointer to point outside of the space that holds the data the
pointer is pointing to.
All pointers pointer to bytes within a data space.
Each data space is max 16 meg in size.
In RPG to allocate some space you typically do something like:
pData = %alloc( %size(data)) ;
the pointer pData now points to bytes within the heap space.
If you come along and add a large value to pData, the system will send
that MCH0601 message if the resulting offset of the pointer exceeds the
bounds of the heap space.
pData = pData + 50000000 ; // bombs. MCH0601.
your code is likely adding an integer variable that contains garbage
data to the pointer. ( probably set to ebcdic blanks, x'40404040' ).
If it is your code that is bombing you can run the program in debug.
The debugger should stop at the line that is adding the invalid offset
to the pointer.
-Steve