FYI - A quote from runtime library reference: "The _Rfeod() function forces an end-of-data condition for a device or member associated with the file specified by fp. Any outstanding updates, deletes or writes that the system is buffering will be forced to nonvolatile storage. If a database file is open for input, any outstanding locks will be released. The _Rfeod() function positions the file to *END unless the file is open for multi-member processing and the current member is not the last member in the file. " If you need to reposition the file after _Reod(), use _Rlocate(). Alexei "We have every reason to assume that our assumptions are not without reason". brian <bsl04@xxxxxxxx> Sent by: c400-l-bounces+pytel=us.ibm.com@xxxxxxxxxxxx 11/01/2006 03:32 AM Please respond to C programming iSeries / AS400 <c400-l@xxxxxxxxxxxx> To C programming iSeries / AS400 <c400-l@xxxxxxxxxxxx> cc Subject Re: [C400-L] Why _Rclose fails On Wed, 1 Nov 2006, Jevgeni Astanovski wrote:
Can anyone give me an advise, why _Rclose can fail?
In main(), you open FileName. The file handle is in fpr. You pass fpr to CallIterate, which closes the file associated with fpr. Inside CallIterate, you open FileName again, assigning it to the *local* variable fpr (local to CallIterate). On the second CallIterate call, CallIterate tries to close the *original* fpr, the one local to main, which is already closed.