× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Constant Scope
  • From: "David Morris" <dmorris@xxxxxxxxxxxxx>
  • Date: Tue, 24 Aug 1999 14:10:49 -0600

Pete,

I have found that global variables in *nomain procedures can only 
be used in the main definitions.  I do think this is wrong, but I was 
never really worried about it.  I found this trying to define the number 
of elements of arrays passed as parameters in a module.  Another 
one I have found is that if I define a procedure statement for a main 
procedure (compiles fine) I get the endless loop effect.

David Morris

>>> <SirZetar@aol.com> 08/24/99 08:21AM >>>
Morning...

I searched the RPG manual, but can't find where it defines the scope of 
global constants.  Did I miss it somewhere?

I know it defines the scope of global variables, ie, available to the main 
program as well as any procedure defined in the same source member.  But I 
haven't found where it would define the scope of global constants.

An assumption that global constants would have the same scope as global 
variables doesn't play out.

When I try to use a constant, defined in the main program, in D specs in a 
procedure in the same source, the compiler complains the constant is not 
defined.  To get it to work, I have to duplicate the constant definition in 
the procedure.

Is this normal, ie, is the scope of a global constant limited to the main 
program?  Or, is this a compiler bug that needs to be reported?

OS/400 & RPG: V4R4M0, latest Cum & Hipers applied.

-Pete

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2024 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.