If I may expand on this - I think that global variables are useful for things that are used everywhere. An alternative is to pass them as parameters to every procedure - this can get a bit cumbersome - so one makes one's choice.

The challenge with globals as I see it is to be sure that there are no side effects - that once set, they are pretty static. Or at least very carefully managed - that has always been a challenge with subroutines.

Now for a utility procedure - with a specific purpose - everything could and perhaps should be done using parameters and local variables and maybe a return value.

JMHO
Vern

On 7/8/2014 8:48 AM, Henrik Rützou wrote:
Buck

this is very easy - take middleware service programs as CGIDEV2, HTTPAPI or
powerEXT. They all have a lot of subprocedures that shares global variables
within
the service program and general storage allocations otherwise they could
not run.


On Tue, Jul 8, 2014 at 3:22 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:

On 7/8/2014 4:46 AM, D*B wrote:
Additinal note:
global data and coupling procedures by global data is not bad design!
Bad design is to define data global, which is needed only local!!!
Hi Dieter,
This surprises me, which means I probably do not understand what you
mean. Could you please give an example of good design that couples
subprocedures with global variables?
--buck
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.