|
Have you thought about EXPORTing and IMPORTing the record? Instead of passing it back and forth, via ptr or by value, what about just using the PREFIX keyword on the File spec for the file in question, then creating an externally described file that is QUALIFIED (the DS name is the same as the qualified prefix used on the PREFIX keyword on the File spec) and then adding EXPORT to that DS. On the other side, you only declare the DS, also externally described and qualified, and included the IMPORT keyword. They now share the same memory space. Of course this only works in two situations. 1) Bind by Copy 2) Between a program and a *SRVPGM when the *SRVPGM's ACTGRP is *CALLER or the same named activation group as its caller. -Bob Cozzi www.RPGxTools.com RPG xTools - Enjoy programming again. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Walden H. Leverich Sent: Tuesday, October 04, 2005 9:04 AM To: RPG programming on the AS400 / iSeries Subject: RE: Passing a pointer as a parameter. >and that's why I was trying to avoid a second >read, Granted I'm jumping in late here, but are you doing all this passing truly just to avoid reading the same row in the table in 2 programs? In some _extreme_ cases that might be worth it, but if these two reads are going to occur at nearly the same time, (pgm a reads, does a couple things, calls pgm b, pgm b reads) then you've got a _really_ good chance that the row is still in memory so the "read" isn't going to cost much at all. Sure, in absolute terms it will be "slower" to do the additional read, but unless you're doing this on a really undersized box, or doing is millions of times in a job I doubt you'd ever see the performance difference -- and if you're doing it a million times it should be in batch so who cares if the job runs an extra 10 seconds. Consider such pathological coupling of programs seriously before you do it -- you're making is much more difficult to reuse Pgm B since anything that calls it must now know how it works. JMTCW. -Walden ------------ Walden H Leverich III Tech Software (516) 627-3800 x11 WaldenL@xxxxxxxxxxxxxxx http://www.TechSoftInc.com Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.)
As an Amazon Associate we earn from qualifying purchases.
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.