|
Hi James, I can think of some possibilities, none of which are overly nice: 1. Define the files that you are not sure of internally with the key info in the F-spec and use USROPN as you have suggested. You may need to cater for the buffer length mismatch on OPEN. As you seem to only need to determine existence this should be enough. 2. Have a "template" for each of the possible files defining them externally and compile the appropriate one (to get the appropriate rest of fields) then call it to return the existence of the keys you are interested in. I am puzzled that you also mention CHAIN. I thought that all you would need is SETLL. 3. Use embedded SQL to do a SELECT INTO for each file and then determine which one at run time. This would only need to mention the fields that you know about. 4. Use the C native IO routines _Ropen, _RLocate & _Rclose. Regards, Kevin Wright
-----Original Message----- From: James H H Lampert [mailto:jamesl@xxxxxxxxxxx] Sent: Tuesday, 4 July 2006 8:58 AM To: rpg400-l@xxxxxxxxxxxx Subject: Knotty puzzle with chaining to files not known at compile time I've got a knotty little puzzle here: I have a number of files. We know what their names are at compile time, but not necessarily which ones actually exist in any particular installation. We know that the files are keyed on two fields; the leading key is either 9, 11, or 13 bytes zoned decimal, and the secondary key is always 5 bytes, but we have no way of knowing at compile time what the length of the leading key is. All of this information can, however, be determined at runtime. We also don't know much about the record structure at compile time, beyond the keys. All we need to know is whether or not records exist for each of a series of specified composite key values. Clearly, the fact that we don't know which of these files exist suggests treating them as USROPN, and not knowing the record structure suggests treating them as program-described. But any ideas on how I would chain to these files? -- JHHL -- 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.