|
Peter Dow wrote: > I think the questions should be "what's the best way to integrate the IFS > with RPG's file handling?" > > I'll throw out a few ideas and you can all shoot holes in them: > > On the Filespec: > 1. Only allow Input or Output on the file spec. > 2. Don't put a record length. > 3. Add a keyword for the external file name similar to the member name > now available in v5r1. In other words, you end up with a file spec that has next to nothing in common with other forms of file spec. > > For the Calculation specs: > 1. Use the READ into DataStructure format. This could work a couple of > ways: > a. Read delimited -- read the input stream into a separate DS > subfield, using EVAL rules, up to user-specified delimiter. > b. Read by size -- read x characters into the DS, where x is the > size of the DS. > 2. Use the WRITE from DataStructure format. Again: > a. Write delimited. > b. Write by size. A better approach would be to read into and write from varing length character variables. In other words, you'd end up with I/O opcodes that have next to nothing in common with other forms of I/O opcodes. > > It doesn't have to handle every possible way to read/write a stream file, > just the most common. But when you have to handle some less common case, you'd still end up having to call the Posix routines directly anyways. And face it, those routines aren't all that difficult to deal with. What's the difference between learning some new RPG function and learning how to call some API? (Well, there's one difference - if you learn the API, you'll also be able to use it when programming in some other language as well!)
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.