J3/02-181r3 Date: May 15, 2002 To: J3 From: Dick Hendrickson as amended by Dan Nagle Subject: FLUSH for files Dick Wrote: A frequent topic on Comp.Lang.Fortran is "How do I flush a file in Fortran?" The answer is "you can't." End Dick Wrote As an alternative to Dick's original FLUSH= specifier proposal, I propose a FLUSH statement, modeled after the file positioning statements. This has the advantage of making (largely, at least) localized edits. The statement is: FLUSH unit -or- FLUSH( UNIT= , IOSTAT= , IOMSG= , ERR= ) This has the further advantage that a simple source file editing script changing "call flush( unit)" to "flush( unit)" makes a standard conforming program, easing efforts of programmers. Implementation may be done by translating the flush statement into the previously widely supported flush procedure. The IOSTAT variable will be given a positive value if an error occurs, a zero value if the operation is successful, and a negative value to indicate processor-defined conditions such as when flush doesn't apply to the unit. Flush should be given as vacuous a definition as possible, since we don't discuss the means of storing files. I propose to say nothing more than that a flush makes data transferred to the file available for further processing, and adding a NOTE stating, roughly, "you know what I mean". EDITS: 11:19+ Add or 175:10 Change "REWIND, WAIT" to "REWIND, FLUSH, WAIT" 177:7 Change "REWIND," to "REWIND, FLUSH," Insert new section after 9.7 (Bottom of page 210): 9.7+ Flush Statement The form of the FLUSH statement is: Rxxx is FLUSH or FLUSH ( ) Rxxx is [UNIT =] or IOSTAT = or IOMSG = or ERR =