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



To re-word a portion of Scotts excellent reply.

RPG procedures can have parameters passed by reference or by value.  But
the returned value is always returned by value.

RPG programs accept only parameters passed by reference and can not
return anything.

Some other languages, Java and C++ come to mind, do allow procedures to
return "something" by reference or by value.

HTH,

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

> -----Original Message-----
> From: rpg400-l-bounces+cwilt=meaa.mea.com@xxxxxxxxxxxx 
> [mailto:rpg400-l-bounces+cwilt=meaa.mea.com@xxxxxxxxxxxx] On 
> Behalf Of Scott Klement
> Sent: Wednesday, April 19, 2006 2:54 PM
> To: RPG programming on the AS400 / iSeries
> Subject: Re: How can I Improve this procedure...
> 
> 
> > can you elaborate on this? I keep hearing it very often but 
> did not find 
> > much explantation as to why?
> 
> Because a return value copies the data from one place to 
> another.  So if 
> you return 3000 bytes, the system has to copy all 3000 bytes from one 
> place in memory to another place in memory.
> 
> By contrast, when you pass a parameter (unless you use the 
> VALUE keyword) 
> the system references the existing copy of the data in 
> memory. It doesn't 
> have to copy it from one place to another, it just uses the 
> original spot.
> 
> > Is this the case with procedures too? Also is it any 
> different if the 
> > procedure is in a service program?
> 
> Since programs can't return a value, this discussion ONLY applies to 
> procedures, and that's what we've been talking about all 
> along. Unless I'm 
> misinterpreting the question?
> 
> No, it doesn't matter if the procedure is in a service program. (or 
> anywhere else)  This has to do with how parameters and return 
> values work. 
> It doesn't matter where the procedures are located.
> 
> > Is it not just a pointer that is returned? Any pointers to 
> books/IBM 
> > resources on this topic will be helpful too.
> 
> No, it is not a pointer that's returned.   I'm sure that 
> there are IBM 
> resources that explain this, but I don't know what they are 
> off the top of 
> my head.  I learned this stuff years and years and years ago, and I'm 
> afraid that I can no longer remember where I originally learned it.
> 
<snip>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.