|
That pretty much what I was doing. I discovered the problem - I was specifying blkrcd=Y on the open, this causes the write to fail with the truncate error. Anyone know the effect in terms of speed and efficiency of using this parameter with regard to sequential writes to a db file opened in wr mode? TrailBlazer Systems, Inc. http://www.as400ftp.com AS/400 Communications & E-Commerce Solutions Chaos, panic and disorder...my work here is done. > -----Original Message----- > From: Dave McKenzie [SMTP:davemck@galois.com] > Sent: Thursday, November 16, 2000 9:00 PM > To: C400-L@midrange.com > Subject: Re: Wite to a save file with _RWrite > > OOPS! Of course I should have checked for EOF from the read before > writing, such > as... > > if (pfFp->riofb.num_bytes != EOF) { > _Rwrite(savFp, aRec, 528); > } > > ...but since it isn't checking for errors, the pgm ignores the escape > msg on the last > write and works fine anyway! > > --Dave > > Dave McKenzie wrote: > > > Here's a little pgm that does that. SAVF528 is a rcdlen(528) > physical containing > > data copied from a savf file with FTP, and ASAVF is a save file. > > > > --Dave > > > > #include <stdio.h> > > #include <stdlib.h> > > #include <string.h> > > #include <recio.h> > > > > static _RFILE *pfFp; > > static _RFILE *savFp; > > > > int main(int argc, char **argv) > > { > > char aRec[528]; > > > > pfFp = _Ropen("SAVF528", "rr"); > > savFp = _Ropen("ASAVF", "wr"); > > > > do { > > _Rreadn(pfFp, aRec, 528, __DFT); > > _Rwrite(savFp, aRec, 528); > > } while (pfFp->riofb.num_bytes != EOF); > > > > _Rclose(pfFp); > > _Rclose(savFp); > > return; > > } > > +--- > | This is the C/400 Mailing List! > | To submit a new message, send your mail to C400-L@midrange.com. > | To subscribe to this list send email to C400-L-SUB@midrange.com. > | To unsubscribe from this list send email to > C400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: > bob@cstoneindy.com > +--- +--- | This is the C/400 Mailing List! | To submit a new message, send your mail to C400-L@midrange.com. | To subscribe to this list send email to C400-L-SUB@midrange.com. | To unsubscribe from this list send email to C400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: bob@cstoneindy.com +---
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.