[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Local Variable Surprise
- Subject: Re: Local Variable Surprise
- From: Joan Hudson <joan@MEDIWARE.COM>
- Date: Thu, 2 Jul 1998 16:06:11 -0700
That's wild! I ran your code and got 0 values for both procs.
I added a show line for ok from my main procedure, and it
too was the expected zero. My test was on sqr 3.0.7.3
for AIX.
joan
>Having a VB and C background, it is my preference in life to pass as
>many variables as possible as parameters between procedures. I have
>been working with an SQR that is calling multiple levels of procedures
>similar to the following:
>
>begin-procedure proc1
> do Proc2 (#OK)
> if #OK = 1
> ! do some processing here
> else
> ! Write error messages
> end-if
>end-procedure
>
>begin-procedure proc2(:#Valid)
> let #Valid = 1 ! setting this procedure to have a valid return
code
> do Proc3(#Valid)
>
> ! expecting the value of #Valid to be 0 at this point
> show 'Proc2 = ' #Valid
>end-procedure
>
>begin-procedure proc3(:#Valid)
> let #Valid = 0 ! setting this procedure to have an invalid return
>code
> show 'Proc3 = ' #Valid
>end-procedure
>
>In this example I was expecting to perform error processing when finally
>getting back up to Proc1. I was quite surprised to find that Proc1 was
>acting like the return code (#OK) was valid. When checking the log I
>found the following:
>
>Proc3 = 0
>Proc2 = 1
>
>I was expecting the "Do Proc3(#Valid)" process to get a return value of
>0 then pass that value to Proc1.
>
>This E-mail is meant to both share information and to request a
>reasonable explanation as to why this is happening?
>
>Thanks
>
>Paul