I am writing a program that creates a user space and then loads it with records from a file that I read. This program used to work several years ago but now I am getting "Space offset X'40404040' or X'0000000000000000' is outside current limit" errors. I am wondering if something has changed in some of the newer releases. We now have V7R2. I have attached part of the code. The line where the error occurred is highlighted. I noticed that when I put it in debug, the values in uOffSetToList, uNumOfEntrys , and uSizeOfEntry are all the same and very large (1077952576), It creates the user space OK but when it assigns the value of the pointer to the user space to the pointer to data structure ListInfoDS is when it aborts
Announcement
Collapse
No announcement yet.
User Space Issue
Collapse
X
-
The user space is being created with blanks (x'40') as the data (SpaceValue 1A has a default initialization value of blank, x'40').
You are using uOffSetToList immediately after creating the user space, so it is expected that it would contain x'40404040' (1,077,952,576).
Code:PointerName = CrtUsrSpc(UserSpace); Exsr LoadUsrSpc; ... Begsr LoadUsrSpc; ListPointer = PointerName + uOffSetToList;
From what you've showed us, I think your code to create the user space would run without error if the user space already existed.
Your call to QUSCRTUS has QUSEC in the error-code parameter. From the code you showed us, the QUSBPRV (bytes provided) subfield of QUSEC isn't set, so that would also be x'40404040', greater than zero, so the API would put error information about the user space already existing into QUSEC, rather than issuing an exception.
If your code isn't setting QUSBPRV, then you have a potential storage corruption problem. With a bytes-provided value of over a billion, QUSCRTUS would be free to update that many bytes of the error code parameter. If it updated more than the size of QUSEC, it would corrupt whatever variables happened to follow QUSEC in storage.
So you should set QUSBPRV to %SIZE(QUSEC). And then you should probably check QUSEC after the call, to make sure that any error you get is an expected error.
Comment
-
Originally posted by gregwga50 View PostI think I see the problem, it looks like I am not giving the user space an initial size when I create it
Comment
-
The user space is being created with blanks (x'40') as the data (SpaceValue 1A has a default initialization value of blank, x'40').
You are using uOffSetToList immediately after creating the user space, so it is expected that it would contain x'40404040' (1,077,952,576).
So you should set QUSBPRV to %SIZE(QUSEC). And then you should probably check QUSEC after the call, to make sure that any error you get is an expected error.
maximum size of a user space, around 16 million (much smaller than the 1 billion your code trying to do).
Thanks so much for your help. Your responses are always very helpful
Comment
-
-
Originally posted by gregwga50 View Post
So, it's because I have x'40404040' or (1,077,952,576) in the uOffsetToList, correct? Just trying to understand. I took that out of my code.
Comment
Comment