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



Return only works if the procedure is coded to return a value.
You need to set the values of pDiv and pDivName.

pDiv = DIV;
pDivName = DIVNAME;


Paul Therrien

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Booth Martin
Sent: Saturday, June 22, 2013 11:50 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Prototype returning more than one value.

Here is the code piece:
// ...................... Prototype
D GETDIVR PR
D 2
D 30
// ....................... Procedure interface
D GETDIVR PI
D pDiv like(DIV)
D pDivName like(DIVNAME)

// ....................... Mainline
C* *ENTRY PLIST
C* PARM DIV 2
C* PARM DIVNAME 30
/FREE
// fill DIV & DIVNAME for return
DIV = '11';
DIVNAME = 'Division Name';
return DIV;
return DIVNAME;
*inlr = *on;

I am only really interested in the values being returned. (This is replacing
3 lines of *ENTRY/PLIST code. There is no new functionality
here.)

On 6/22/2013 7:14 AM, Vernon Hamberg wrote:
hi Booth

When you pass parameters, it can be no different than it always has
been - a change in the called program is seen in the caller, as you
expect.

Things CAN be different if you declare parameters by VALUE or even
CONST. You probably should not be using either of these if modifying
existing stuff to replace *ENTRY PLIST.

That's not really what I think of when you say "return" - that would
be a return value and is specified on the PR/PI line. Only procedures
can return something, not programs - same as always.

If you're changing an existing program, be sure the variable and
parameter names are right, that you are actually putting a value into
both parameters.

Also, be sure lengths and types are the same.

Maybe you can show us your prototype.

HTH
Vern

On 6/22/2013 12:57 AM, Booth Martin wrote:
So I am learning more about prototypes and procedure interfaces and
replacing *ENTRY/PLIST. This is more confusing then I expected.

Here is the scenario:
I have PROGA which has 2 fields to populate; ID# & description.
I have PROGB which displays a subfile of the ID#s and descriptions.
PROGA has a line of code: PROGB(ID#: DESC);

Everything appears to me to be working as desired except that I can
not get the two field's values returned.
It appears to me that I can only return one value. That can't be
right. I must be taking a wrong turn somewhere.



--
Booth Martin
802-461-5349
http://www.martinvt.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 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.