call setmod(unit, init)
SETMOD specifies the I/O mode of a direct access file. If a file was not created by the OPEN statement, the I/O library will assume that the access mode is input/output and that the direct access file has previously written records that are to be preserved. A call to SETMOD is needed to specify that the contents of direct access file are to be ignored, and the file initialized. This is particularly important when the file has been created by using ACCESS or $FILSYS, and so the content has never been properly formatted as a Fortran direct access file.
SETMOD must be called before I/O operations (except OPEN) are performed on the direct access file. A subsequent READ statement will automatically reopen the file in update mode.
Copyright © 1996, Thinkage Ltd.