John,
Just one question Would you write a program (1 member) for a single or only
a few statements?
As long as you are working with OPM only I'd expect you'll answer no.
Even though the statement is complex (for example nesting multiple
built-in-functions) you'll copy it or maybe you'll copy the few statements
into a subroutine.
Another approach would be using copy members, even thought I'd expect you'll
not create and use a copy member for a single statement.
If something has to be changed, you need to find all occurrences, revise
them and recompile your programs.
Using the ILE concept you may split all your programs into reusable small
pieces (exported procedures), that are located in multiple service programs
according their functionality, i.e. you may group all string procedures
together, all date time procedures, all insert, update, read, delete
procedures for a single file/table etc.
What you need for exploiting the ILE concepts, is to learn thinking really
modular.
When we started with ILE, I thought we were modular, because all our
programs were split into multiple sub-programs.
Today I get tears into my eyes, if I remember what I interpreted as modular.
Most of our procedures are really small (less than 50 statements with a few
exceptions) and almost all procedures can be called from outside.
In this way we are very flexible and can easily write and modify even very
complex programs.
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 John
Yeung
Gesendet: Sunday, 20.7 2014 09:11
An: RPG programming on the IBM i (AS/400 and iSeries)
Betreff: Re: The value of ILE
Dieter,
I appreciate your response. Still, I disagree, a little bit:
On Sun, Jul 20, 2014 at 2:36 AM, D*B <dieter.bender@xxxxxxxxxxxx> wrote:
The very diffrence between a PGM and an ILE SRVPGM is, that a SRVPGM
has multiple entry points: a SRVPGM is a collection of exported
procedures with shared memory. Each procedure could have private variables
too.
One of the patterns, often used in Business applications are (for
example) DataAccess Modules providing readNext() read(key), update(),
insert(),
delete() setOrderBy(), newCursor().... If you would try this with OPM
and programm call, you would end up with unreadable and unusable code.
I understand what you are saying here, and I think a service program is
*nicer* than a corresponding OPM program, but you can do this pattern using
OPM without making it unreadable and unusable. I guess that depends on what
you consider "readable". ;) But you can take the system API approach and
have, say, one parameter which tells you which function to use and then
either a bunch of small, sometimes optional parameters if they can be the
same types among the different functions, or a big parameter that you need
to chop up with different data structures depending on the function.
Everybody keeps saying that the way to handle ILE prototypes is to put them
in /COPY members.
Well, just have the corresponding data structures in /COPY members instead.
Second point for ILE is, that the compiler does more work for the
programmer, compared to OPM.
I can't disagree with that.
Compared to C/C++/Java/C# on other platforms, the ILE compiler does
this job not very well and the IDEs and Editors are even worse.
OK, this doesn't sound like it's discussing the relative merits of ILE
versus OPM anymore. ;) (But I will say that I have personally found ILE a
pain to use with just PDM, SEU, and the command line.)
John
--
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.