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



On 2010/11/4 6:47 AM, David FOXWELL wrote:
... I'm not fully appreciating the advantages of this feature.
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.

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!


David, if you do want to separate your file operations into another module or service program, then it can be easier to define the actual file in the caller and pass it as a parameter to the procedures in the service program. The alternative is to define the actual file in the service program, but then there is the possibility of inadvertent file "sharing" if more than one program calls that service program.

If more than one module is involved, then normally the template file would be in a /copy file that is copied into both modules. The module declaring the actual file would use LIKEFILE to define it.

What is being passed is RPG's internal data structure that it uses to keep track of the file.

If you define the files in both caller and callee, and want them to work together with the same "file-open", then you have to share the file. Not necessarily a problem, but the scope of the share is for the entire activation group (or job). With file parameters, you explicitly "share" the file-open and can control exactly which modules or procedures can see the file-open.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.