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



Comments in-line

Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On Nov 4, 2010, at 9:48 AM, rpg400-l-request@xxxxxxxxxxxx wrote:

Would that be that it permits having all file operations in the callee? With the file having to be declared in both caller and callee, I don't really get the advantage.

1) It avoids the file being opened multiple times (file open is relatively expensive)

2) It makes it possible to write more generic routines for file handling (think subfiles for example) that take advantage of the fact that the current cursor position comes "with" the file.

There are a bunch more but these are the main ones. Like a lot of new functionality the usage is not always immediately apparent, becuase we've got used to building things a certain way. We tend to constrain our designs to fit the mental set of "tools" that we have. If you were to reverse the scenario and ask a C programmer (for example) how they would design an application in a scenario where they could _not_ pass files as parms they would be astounded that you could even contemplate such a restrictive scenario.

Also, WHAT exactly is being passed as the first parameter? Why is the file template not in the caller instead of the callee? What's the advantage over declaring the files in both caller and callee and passing only 2 parameters, the key and the record? Thanks!

What is passed? Nothing that is of any use to you other than for its intended purpose. It is an internal reference to the associated entries in the RPG run-time. Think c-style file handle. The file itself has to be defined (and is "owned") by the first program in the chain. Any subsequent program/procedure in the chain needs to know what the file looks like hence the need for the template. The advantage as I've already noted is that only one open is done.


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.