|
On Thu, 24 Mar 2005 16:33:20 -0600, Bob Cozzi <cozzi@xxxxxxxxx> wrote: > RPG IV is a bit more complicated when writing CSV files... > C eval hIFS = csvOpen('/mydir/filename.csv': > C 'APLIB/CUSTMAST') > > C Read CUSTMAST > C return csvWrite(hFile:CUSTDATA) > > Perhaps not as clean a C++ but just as easy. now that is proof that beauty IS in the eye of the beholder! in C++ I added an operator[ ] function to the CsvString class. std::string sName ; CsvString line ; sName = line[3] ; // extract the 4th value in the string. I never tried it but you can probably overload operator[ ] in a database file class to perform a chain to a file: PayrollMasterByNumber master ; PayrollRecord record ; master << record ; // add a record to the master file record = master[ EmployeeNumber ] ; // chain to master file by key you can get real wild with all of this and have a const and non const version of the operator[ ] member function of the PayrollMasterByNumber class. When used on the left side of the expression, your code calls the non const version of the function and updates the record. When used on the right side, you call the const version and read the record. // update the record with key EmployeeNumber. master[ EmployeeNumber ] = record ; // read the record by key EmployeeNumber record = master[ EmployeeNumber ] ; -Steve
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 copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.