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



Personally, I'd prefer a more well defined interface...

setFromAddress()
setToAddress()

And I try to stay away from those...to much like the old move to a work
variable before calling a subroutine IMO.

But for certain functionality, such as your mailtool. I can see the
benefit.

Not sure if it's a technique you want to use as an introduction to ILE
however ;)

Charles

On Tue, Jan 6, 2015 at 5:13 PM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

One thing I've been doing lately for subprocedures instead of passing a lot
of parameters (which can change over time) is using "setters" before
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 second
is the actual value which is set up as a global field in the module/service
program.

Inside the setValue() subprocedure is really just a large select statement
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

On Tue, Jan 6, 2015 at 3:25 PM, Roger Harman <roger.harman@xxxxxxxxxxx>
wrote:

iProDeveloper.com is one good site for references. Code400.com is
another.

Take a look at this:

http://iprodeveloper.com/rpg-programming/introducing-ile-service-programs

Jon & Susan have done a number of presentations on this topic. Here's a
link to one they did eons ago at my LUG.
http://www.partner400.com/advancedsubprocs.pdf


Roger Harman
COMMON Certified Application Developer – ILE RPG on IBM i on PowerOCEAN
User Group – Vice-President, Membership (2014)

From: ACassidy@xxxxxxxxxxxxxx
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: Service programs, procedures, not sure what to do
Date: Tue, 6 Jan 2015 19:58:22 +0000

It looks to me like Jack hasn't done subprocedures before, and this is
a
first step. Correct me if I'm wrong.

For my first few times writing them, I just created my procedure
functions in the same program.

Then I went to service programs, which involve more than can be
explained in a short list email.

There are some good articles in the midrange press. I recommend looking
at their examples.
(They might be kind of old, and fixed-format, but they still work and
serve the purpose)

--Alan


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Jeff Young
Sent: Tuesday, January 06, 2015 2:19 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Service programs, procedures, not sure what to do

Jack,
You need to specify NOMAIN in the H specification keyword.

Jeff Young
Sr. Programmer Analyst

On Tue, Jan 6, 2015 at 2:14 PM, Jack Tucky <jacktucky@xxxxxxxxx>
wrote:

That's what I was trying to figure out. Compiling as a service
program
I get the same error, return value not allowed for the main
procedure



FCodeFF00 if e k disk

d CODE001R PR 1n

d cdGroup_ 3s 0 const

d cdCode_ 50a const

d CODE001R PI 1n

d cdGroup_ 3s 0 const

d cdCode_ 50a const

d exists_ like(*in01)

**



chain (cdGroup_:cdCode_) Codeff00r;

if %found;

exists_ = *on;

else;

exists_ = *off;

endif;



return exists_;





Thanks for quick responses...



-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Jeff Young
Sent: Tuesday, January 06, 2015 1:47 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Service programs, procedures, not sure what to do



Jack,

A *program* can not return data.

If you need to return data from another program, define the return
field a parameter in the caller and called program.

If you create a service program with your procedure, that can
return
a
parameter with no problem.



Jeff Young

Sr. Programmer Analyst



On Tue, Jan 6, 2015 at 1:38 PM, Jack Tucky <
<mailto:jacktucky@xxxxxxxxx> jacktucky@xxxxxxxxx> wrote:



If I want to put this code in another program, how would I define
the

procedure there?







On Jan 6, 2015, at 1:31 PM, Buck Calabro <
<mailto:kc2hiz@xxxxxxxxx>
kc2hiz@xxxxxxxxx> wrote:



On 1/6/2015 12:29 PM, Jack Tucky wrote:



I tried to code the PR/PI in my first RPG and it says I can't

return a value. Do I need something different? Sorry I'm so

vague. I'm still

not

where I need to be on procedures/service programs, etc.



In order to return a value, you need to tell the procedure
interface

(and prototype) that. Here is an example of a procedure that
takes

a 10 character 'date' and converts it into an 8 digit number.
The

place where we define what gets returned is on the PI spec;
here
it's
'8s 0'.

The actual /value/ that gets returned is in the return
statement

(here, unimaginatively called retVal).



* convert 'yyyy-mm-dd' to yyyymmdd

p date10to8 b

d date10to8 pi 8s 0

d date10 10a const

...

d retVal s 8s 0 inz

...

return retVal;

p e



You'd do something similar with your 'return the next number'
procedure.



--

--buck



'I had nothing to offer anybody except my own confusion' - Jack

Kerouac

--

This is the RPG programming on the IBM i (AS/400 and iSeries)

(RPG400-L)

mailing list

To post a message email: <mailto:RPG400-L@xxxxxxxxxxxx>
RPG400-L@xxxxxxxxxxxx To subscribe,

unsubscribe, or change list options,

visit: <http://lists.midrange.com/mailman/listinfo/rpg400-l>
http://lists.midrange.com/mailman/listinfo/rpg400-l

or email: <mailto:RPG400-L-request@xxxxxxxxxxxx>
RPG400-L-request@xxxxxxxxxxxx Before posting, please take

a moment to review the archives at

<http://archive.midrange.com/rpg400-l>
http://archive.midrange.com/rpg400-l.



--

This is the RPG programming on the IBM i (AS/400 and iSeries)

(RPG400-L) mailing list To post a message email:
<mailto:RPG400-L@xxxxxxxxxxxx> RPG400-L@xxxxxxxxxxxx

To subscribe, unsubscribe, or change list options,

visit: <http://lists.midrange.com/mailman/listinfo/rpg400-l>
http://lists.midrange.com/mailman/listinfo/rpg400-l

or email: <mailto:RPG400-L-request@xxxxxxxxxxxx>
RPG400-L-request@xxxxxxxxxxxx Before posting, please take a

moment to review the archives at
<http://archive.midrange.com/rpg400-l>
http://archive.midrange.com/rpg400-l.





--

This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
<mailto:RPG400-L@xxxxxxxxxxxx> RPG400-L@xxxxxxxxxxxx To
subscribe,
unsubscribe, or change list options,

visit: <http://lists.midrange.com/mailman/listinfo/rpg400-l>
http://lists.midrange.com/mailman/listinfo/rpg400-l

or email: <mailto:RPG400-L-request@xxxxxxxxxxxx>
RPG400-L-request@xxxxxxxxxxxx

Before posting, please take a moment to review the archives at
<http://archive.midrange.com/rpg400-l>
http://archive.midrange.com/rpg400-l.



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


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




--------------------------------------------------------------------------------
Confidentiality Notice: This email may contain confidential information
or information covered under the Privacy Act, 5 USC 552(a), and/or the
Health Insurance Portability and Accountability Act (PL 104-191) and its
various implementing regulations and must be protected in accordance with
those provisions. It contains information that is legally privileged,
confidential or otherwise protected from use or disclosure. This e-mail
message, including any attachments, is for the sole use of the intended
recipient(s). Any unauthorized review, use, disclosure or distribution is
prohibited. You, the recipient, are obligated to maintain it in a safe,
secure and confidential manner. If you are not the intended recipient,
please contact the sender by reply e-mail and destroy all copies of the
original message. Thank you.


--------------------------------------------------------------------------------


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


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


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