Re: Local variable acting static in 4GL report
Posted in 1997
Local variable acting static in 4GL report That's right - they do. I've seen (and written!) lots of reports which would break if they didn't. If you want to accumulate some form of running total (say a page total) which fails to fit the standard aggregate mechanism you really need static local variables. I must admit that until I read this post I hadn't even thought of such variables as being other than static. I suppose that's because I came to 4GL reports by way of ACE where there isn't such a concept as a local variable. Ian Jacob Salomon wrote: > > Hi folks, > > something strange is interfering with my debugging session. > I'm using all incarnations 4gl release 6.01.UD2 on HP-UX 10.01 > > I have a breakpoint at the entry to a report function, with the command > to print a local (to the report function) record variable named "tv". > The first time, all its members (smallints) are 0, of course. During > the course of the report, the various smallints are bumped up. However, > I expect it to *always* be 0 when I call the report function again. The > variable should be getting allocated on the stack and reinitialized > every time the function is entered. > > However, I am finding that upon entry to the report function the values > are set to whatever they were during the last "after group of" statement > block. > > This violates my understanding of local variables. I wonder if it is > causing a subtle program bug. > > Any ideas out there? > > Thanks. > -- > -- Jake Salomon > . . > _..-'( )`-.._ > ./'. '||\\\\. }\\_/{ .//||` .`\\. > ./'.|'.'||||\\\\|.. )o o( ..|//||||`.`|.`\\. > ./'..|'.|| |||||\\`````` \\'@'/ ''''''/||||| ||.`|..`\\. > ./'.||'.|||| ||||||||||||. | .|||||||||||| ||||.`||.`\\. > /'|||'.|||||| ||||||||||||{ | }|||||||||||| ||||||.`|||`\\ > '.|||'.||||||| ||||||||||||{ | }|||||||||||| |||||||.`|||.` > '.||| ||||||||| |/' ``\\||`` | ''||/'' `\\| ||||||||| |||.` > |/' \\./' `\\./ \\!|\\ /|!/ \\./' `\\./ `\\| > V V V }' `\\ /' `{ V V V > \\ \\ \\ V / / / > +-----------------------------------------------------------+ > | Impeccable Logic: A thought process which successfully | > | resists chicken bites | > +-----------------------------------------------------------+