×
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.
If I have to maintain existing code I do not convert every subroutine to a
sub-procedure.
For me a sub-procedure is something like an encapsulated "mini" program,
that receives parameters and returns either parameters or a return value and
uses local variables.
If a subroutine cannot be encapsulated, i.e. if only global variables are
used, I do not convert it into sub-routines.
For new development new programs I try to encapsulate everything that can be
reused or must be repeatedly called into procedures. I even go further, I
try to implement (almost) every procedure as exported procedure, so it call
be called from everywhere.
The main problem when beginning with ILE concepts, is to learn how modular
is modular, how to encapsulate source code into procedures.
As soon as you have learned thinking modular, you'll notice, subroutines are
no longer necessary.
The first procedures we wrote were nothing else than sub-programs. Today I
get tears in my eyes about what we considered as "modular". ... but over the
time even those sub-programs/procedures where pruned, sub-routines converted
into additional (exported) procedures etc.
... I can't remember when I coded my last subroutine. (and we have are
working with highly modularized applications)
Instead of an *INZSR, I use either an internal procedure or a subroutine
that does everything I'd do in the *INZSR. This sub-routine/procedure is
executed as the first statement in the main procedure.
In this way I've no problem with repeated calls if someone decides ending
the program with RETURN instead of *INZSR or if someone converts the cyclic
main procedure into a linea main procedure.
BTW this sub-procedure is almost the only internal procedure I use.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Booth
Martin
Gesendet: Wednesday, 09.9 2015 02:25
An: RPG programming on the IBM i / System i
Betreff: Style choices
Sometimes I befuddle myself. This is one of those times.
It was suggested to me that we should be using PR & PI instead of
subroutines. Is that a good suggestion? Does that include *INZSR too?
As an Amazon Associate we earn from qualifying purchases.
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.