|
Why do you think this is a bug? I would have expected it to work as it did. When a subprocedure has a local variable with the same name as a global variable, the local variable overrides the global while in that subprocedure. The Global variable becomes invisible to that subprocedure. A named constant is effectively the same thing as a variable (must have a unique name compared to other variables within its scope). -Bob Cozzi On 6/6/06 5:35 AM, "PAPWORTH Paul" <Paul.Papworth@xxxxxxx> wrote:
We are at release V5R3M0. and have just encountered a bug which may be
of interest.
We have global variable defined
D work_ind s 1A inz
D false c '0'
In a sub procedure we have
D work_ind c 'XX'
In the same sub procedure with the value of the global work_ind set to
'0' (false)
The following test fails
If work_ind = false ;
Do something
Endif ;
After giving the constant a unique name (work_ind_xx) the programme
worked fine.
The constant was being used in place of the global variable.
I would have thought that the compiler would have highlighted this as a
warning although I admit we should rethink our standards.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.