× 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.



Nathan, I don't really see how your exsr example is any clearer than:

dow not %eof();
process-record();
read record;
enddo;

One nice advantage of subprocedures, to me, is that local variables are
set to their initial values on each invocation, replacing all those
clears and evals we used to need in subroutines.

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Nathan Andelin
Sent: Tuesday, July 08, 2014 2:31 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Are subroutines codependent?

I think there's some risk of becoming pedantic about procedures vs.
subroutines. You can become overly concerned, even ostentatiously
concerned
about replacing subroutines with procedures. I see evidence of that
attitude. I have written thousands of procedures and hundreds of service
programs. But I still use subroutines to enhance readability of code.
One
common example is to use a subroutine to separate record processing from
a
record read loop.

read record;

dow not %eof();
exsr process-record;
read record;
enddo;

I'm also not comfortable with the term "global" vs. "local" to define
variable scope. You might distinguish rather between variables scoped to
a
procedure, a module, or even data exports and imports which are shared
between programs and service programs within an activation group. Be
more
precise about describing the scope of variables.

Use subroutines to block code for readability. Use procedures and
service
programs when you need a routine to return a value, and when the routine
will be called from multiple programs or service programs.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.