|
> In my CL program, I have a file declared with DCLF. The > file was read by > RCVF. After end of file has been reached, I want to read > the file again. I > have tried to open the file again with OPNDBF, but the > file won't be read > again. Does anybody has an idea for this old CL progamming > technics? (All answers assume OS/400 V5R2 and less) POSDBF won't work if you have already hit EOF. Once a CL program reaches CPF0864 on a file, it will not reposition. There are two methods that I have seen. I like the second method better than the first. 1st Method) Do a RTVMBRD on he file, retrieve the number of records in the file (n), and when you program reads record (n) do a POSDBF to the first record before you reach EOF. The obvious problem with this method is that if someone is else is updating the file, your record count could be worthless. 2nd Method) Read the file as normal, and when you receive message CPF0864, do a TFRCTL to the same program name. A TFRCTL starts a new job stack (as opposed to a CALL, which does not refresh the call stack), and will allow you to open the file afresh. HTH, jte -- John Earl | Chief Technology Officer The PowerTech Group 19426 68th Ave. S Seattle, WA 98032 (253) 872-7788 ext. 302 john.earl@xxxxxxxxxxxxx www.powertech.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.