|
To be fair, Hans, I can code in Native RPG IV a *lot* faster than coding to an API in RPG. If I want to read a records from a DB2 file I code an F spec, a setll, a read(e), and a not eof() If I want to read from an IFS file I have to write a Prototype for the file open, prototype for the file read, prototype for the file eof, prototype for the file close, then I can actually write my program. True, I can design these once and put them in a library and link to that, but now I have more maintenance issues, etc... So, 4 lines of file I/O code native .vs., what, 25-30 lines of code to write to APIs? Understand, I'm not saying that Rochester should drop everything and write native RPG IFS file I/O <g>, I'm just saying there is a point for native RPG file I/O Regards, Jim Langston Programmer/Analyst NT Administrator Cels Enterprises, Inc. (310) 838-2103 x604 -----Original Message----- From: Hans Boldt [mailto:boldt@ca.ibm.com] 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.