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



Hi David,

I have not yet played with this, still on V5R4 here... However, I
understand this to be essentially the same as file handles from the
unix/C world. You open the connection to the resource once, then pass
the open descriptor (handle) to other procedures that need to access
that resource. The OS benefits from not needing to maintain so many
ODPs, buffers, file open/close ops, etc.

Making use of this might make sense in a tight, well architected ILE
application, where you can more easily manage your implementation. I
think this could be a disaster in a mixed OPM/ILE environment...

Jmo,
-Eric DeLong

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Thursday, November 04, 2010 5:48 AM
To: RPG programming on the IBM i / System i
Subject: Passing Files as Parameters

Hi,

With V7 approaching our shop and realizing I haven't yet put into
practice much of the V6.1 enhancements, I was looking at Passing Files
as Parameters. I have an example from systemideveloper by Paul Tuohy,
but 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!


Caller :
FcustMast IF E K Disk

D custRecord DS LikeRec(custRec)
D GetCustData Pr N
D custFile LIKEFILE(custMast)
D custData LikeRec(custRec)
D custKey Like(custNum)

/Free
If GetCustData(custMast: custRecord: 'TESTKEY')

/end-free


Called procedure :
FcustMast IF E K Disk TEMPLATE

P GetCustData B
D GetCustData PI N
D custFile LIKEFILE(CustMast)
D custData LikeRec(CustRec)
D custKey Like(custData.CustNum)

/Free
Read custKey CustFile custData;
If %Found(custMast);
Return *On;
Else;
Return *Off;
EndIf;
/end-free

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.