|
Joep,
That's exactly how I do it. I think the only difference is your reset
action, which I actually use as a proc itself. (in reality, I have an
init() and reset() procedures that do similar things, such as setting
values to defaults, etc).
My description wasn't 100% complete, but hopefully enough to get the point
across. I find it MUCH easier than passing a bunch of parameters, which as
we know can and will change over time.
Brad
www.bvstools.com
On Thu, Jan 8, 2015 at 3:43 AM, <j.beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Brad,
If you use setters that way, where are the values stored? If these
subprocedures reside in a service program, you use the service program as
a sort of singleton object. I would prefer something like this:
reset MailData;
setValue(MailData :'fromAddress':'jclarkson@xxxxxxxxxxx')
setValue(MailData :'toAddress':'rhammond@xxxxxxxxxxx')
setValue(MailData :'subject':'Come drive the new Ariel Atom')
setValue(MailData :'message':message)
sendEmail(MailData);
It's almost like Java :-) (And I don't even like Java!)
Joep Beckeringh
From:lot
Bradley Stone <bvstone@xxxxxxxxx>
06-01-2015 23:13
Subject:
Re: Service programs, procedures, not sure what to do
One thing I've been doing lately for subprocedures instead of passing a
of parameters (which can change over time) is using "setters" beforesecond
calling the real subprocedure.
An example is the ILE subprocedures I did for our MAILTOOL application.
Instead of sendEmail(fromAddr:toAddr:subject:message:......)
I use "setters" to set the value of values that can be used by the
subprocedure. The first parm in the setter is the value to set, the
is the actual value which is set up as a global field in themodule/service
program.statement
Inside the setValue() subprocedure is really just a large select
that sets the values as they are passed in.--
setValue('fromAddress':'jclarkson@xxxxxxxxxxx')
setValue('toAddress':'rhammond@xxxxxxxxxxx')
setValue('subject':'Come drive the new Ariel Atom')
setValue('message':message)
sendEmail();
This is a very high level explanation of how I do it, but so far it's
working quite splendidly.
Just something to think about if you're just starting out with
subprocedures.
ps.. I also prefix them according to their use, so these would all be
mailtool_setValue, mailtool_sendEmail, etc...
Just an idea while you take your exciting journey down the ILE road. :)
Brad
www.bvstools.com
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 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.