All,

Sorry for leaving this thread for so long. I went off to run a small
experiment, and the experiment showed definitively that I knew less than
I thought I did. The phonomenon is, ummm, not entirely unprecedented
<grin />.

On Thu, 2008-07-31 at 10:09 -0500, Kurt Anderson wrote:
Sorry man, I thought helping her understand what the person's question
meant about scoping would benefit her as a programmer.

Kurt,

Not your fault. I suspect that I contributed to Scott's response by
questioning a couple of times about the scope of `wa`.


Kurt Anderson
Application Developer
Highsmith

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, July 30, 2008 3:45 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: CEE0810 Error on Reallocate Statement

Who cares what the scope of 'wa' is?

Scott,

Lorraine has since answered, and her answer rules out the possibility I
was thinking of. To wit, if wa retained its value from one call to the
next but arrayPtr was procedure-local, then the procedure could try to
realloc without having done the alloc.

 // allocate storage, if necessary
if wa = *zero;
wa = 100;
arrayPtr = %alloc(wa * 32);
endif;
.
.
.
if b2 > wa;
wa += 100;
arrayPtr = %realloc(arrayPtr:wa * 32);
endif;

Mind you, I do not know the meaning of `%realloc(*NULL)`.

Cheers,
Terry.


The scope of 'arrayPtr' might be an issue -- if the symptoms were a
little different -- but I can't see how the scope of 'wa' could ever
matter!

At this point, I'm betting that either the memory has already been
dealloc/realloc or that there's memory corruption.

Kurt Anderson wrote:
Lorraine, just as a fyi, wa is scoped locally (to the procedure) as
opposed to globablly (to the service program). Sorry I don't have
anything otherwise helpful to pitch in here.




This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].