|
Rob,I was commenting on your first example, which you sort of replaced with your second example because you don't like priming reads. I did not count three reads, but three %eofs:
*inlr=*on; read(e) myfile; if not %eof(myFile); (#1) Dow not %eof(myFile); (#2) read(e) myFile; if not %eof(myfile); (#3) // your processing here; endIf; EndDo; EndIf;The outer IF is totally unnecessary; it is handled by the DOW. Next you start the code within the DOW with another READ, thereby discarding the data you got on the first read. So you should position the READ within the DOW after the data processing, which makes the second IF unnecessary as well.
The other thing I commented on was your use of the error extender without handling the errors. I don't even know where the file pointer is after an error; according to the manual you should reposition. So either you don't use the error extender and let *PSSR or the caller of this program handle the errors or you use the error extender and handle the errors.
Joep Beckeringh rob@xxxxxxxxx wrote:
One, How does this have three reads? *inlr=*on; dow ReadFile(Myfile); // your processing here; EndDo; Two, In your example, what happens if I add this ITER line? *inlr=*on; read myfile; Dow not %eof(myFile); // your processing here; iter; read myFile; EndDo; Rob Berendt
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.