Thanks Barbara!
I got past the compile situation by separating out the procedure to its own module, and it compiled okay as such, as a module. I haven't tested it yet, but I suspect I'll have to revisit the logic as the automatic stack is now static (heap storage?).
Does this mean that using STATIC on the big variables would have worked better? Now that I think about it, that would have make it much faster. Duh. The caretaker logic to ameliorate residual data from previous calls would probably be insignificant. And this process is going to have very heavy use.
The procedure had just one parameter, 640a with VARYING and CONST already. So too the module now.
I got the same message when I compiled from a fresh job and interactive, so it wasn't the compiler hitting at an accumulation of storage from the job, as Peter described for his situation.
Thanks again, folks!
Alan Cassidy
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Thursday, October 10, 2013 5:50 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Automatic storage for procedure exceeds maximum.
On 10/10/2013 4:57 PM, Alan Cassidy wrote:
But I brought down my length for the two above fields to 160,000.
The job log message is MCH4216, and here is the message. My automatic
storage for the procedure does not add up to that high with the lesser
value, so what am I missing?
The automatic storage needed by your procedure comes from
1. the automatic variables you define in the procedure 2. automatic temporary variables added by the RPG compiler when it generates the code for your module 3. automatic temporary variables added by the system when it creates your module
The third category is associated with return values and parameters passed by value on actual call statements within the procedure. (And maybe other things, but I only know about the call impacts.) Each call will require its own set of additional automatic storage.
The amount of automatic storage required for a call is related to the size of the return values and the parameters passed by value.
(Parameters passed by reference are also relevant, but the amount of auto storage for those is 16 each, since the parameter is actually a
pointer.)
There are a couple of things you can do to reduce the amount of auto storage needed on a call:
- use RTNPARM if you are on 7.1. That will avoid the whole issue of a return value, from the system's point of view. It will cause the return value to be actually handled as an extra parameter.
- change VALUE to CONST for large parameters. If you need to change the parameter within the procedure, define a local variable and copy the parameter to the local variable, and modify the local variable instead of the parameter.
--
Barbara
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--------------------------------------------------------------------------------
Confidentiality Notice: This email may contain confidential information or information covered under the Privacy Act, 5 USC 552(a), and/or the Health Insurance Portability and Accountability Act (PL 104-191) and its various implementing regulations and must be protected in accordance with those provisions. It contains information that is legally privileged, confidential or otherwise protected from use or disclosure. This e-mail message, including any attachments, is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. You, the recipient, are obligated to maintain it in a safe, secure and confidential manner. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Thank you.
--------------------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.