|
Hi Joe, In v5r1 what you are asking for is actually doable. Here is how I do it: 1st, I have a srcmbr that contains all my prototypes, qualified data structures, constants, ... In that srcmbr I dcl an external ds: d rAtm e ds extname(AcfAtm) qualified ( where AcfAtm is a physical file. ) Then in the module that declares the file, I use PREFIX to add "rAtm." to each field in the file: fAcfAtm1 uf a E k Disk usropn rename(AcfAtmr:AcfAtm1r) f prefix('RATM.') ( AcfAtm1 is a logical view of AcfAtm ) Now, all the flds of the rcdfmt are refered as flds in the qualified ds "rAtm" if rAtm.IsActive = conTrue ; endif ; Here is a proc that reads a record from the AcfAtm file and returns it thru a reference parm: ** ---------------------- AcfAtm_ReadLatest --------------------- ** AcfAtm_ReadLatest - read latest AcfAtm of SendFxid pAcfAtm_ReadLatest... p b export dAcfAtm_ReadLatest... d pi d InSendFxid value like(AcfRef.SendFxid) d OutAtm likeds(rAtm) d OutFound n options(*NoPass) d fFound s n /free ..... setgt InSendFxid AcfAtm1r ; dow conTrue ; readpe(n) InSendFxid AcfAtm1r ; select ; when %eof( ) ; fFound = conFalse ; leave ; when rAtm.IsActive = conFalse ; iter ; other ; fFound = conTrue ; OutAtm = rAtm ; leave ; endsl ; enddo ; ...... /end-free p e -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Joe Pluta Sent: Tuesday, August 12, 2003 11:28 PM To: 'RPG programming on the AS400 / iSeries' Subject: Prototypes, /COPY and LIKE() Okay, I'm running into an issue. I've gotten very good about creating modules and using /COPY to separate the external prototypes for procedures. This works wonderfully except for one specific situation. Often, I like to pass a database field as a parameter. I've learned over the years that the best way to define such a field is by doing a LIKE define against the actual database field. For example: d SccIOKWClear pr d ID like(KWDFID) value d Format like(KWFMT ) value This function clears all the records from the file with the two key fields specified. Works like a champ, provided I have defined KWDFID and KWFMT. However, with a /COPY prototype, there's no simple way of importing the database definitions in order to do a LIKE define against them. I could include an externally described data structure, but now I'm looking at wasted storage and possible name space collisions. Thus my dilemma. My current thinking is to use a based external DS with a prefix. This would "waste" only the space for a pointer, thus: d __SCCKW e ds extname(SCCKW) based(__) prefix(__) d SccIOKWClear pr d ID like(__KWDFID) value d Format like(__KWFMT ) value (The double underscore is just an idea; I could just as easily use a double @ or something else to try and minimize collisions.) Any comments? Joe _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.