Guardian Procedure Calls Reference Manual
tape-disposition.<13:15> denotes:
Rewind, unload, do not wait for completion.0
Rewind, unload, do not wait for completion.1
Rewind, leave online, do not wait for completion.2
Rewind, leave online, wait for completion.3
Do not rewind, leave online.4
Other input values result in no error if the file is a tape device; the control action might be
unpredictable.
Returned Value
INT
Either a file-system or a SIO procedure error code that indicates the outcome of the close operation.
In any case, the file is closed.
If the abort-on-error mode (the default) is in effect, the only possible value is 0.
Considerations
• When to use CLOSE^FILE
Data can be lost if a WRITE^FILE with a count of -1 is not specified or a CLOSE^FILE is not
performed against EDIT files or files that are opened with write access and blocking capability
before the process is deleted.
• If BREAK is taken, CLOSE^FILE gives BREAK (if owned) to its previous owner.
• For tapes with write access, SIO writes two end-of-file marks (control 2).
• CLOSE^FILE completes all outstanding nowait I/O operations on files that are to be closed.
• If errors occur on more than one file when closing the common FCB, the last encountered error
is reported.
• $RECEIVE and CLOSE^FILE
If the file is $RECEIVE and the user is not handling close messages, SIO waits for a message
from each opener. It then replies with either error 45, if read-only access, or error 1, if
read/write access, until there are no more openers.
• Errors with CLOSE^FILE
If you call CLOSE^FILE on the common FCB and if an error is encountered when closing one
of the files, the resulting action depends on the setting of ABORT^XFERERR for that file.
(ABORT^XFERERR is set by OPEN^FILE or SET^FILE.) If ABORT^XFERERR is true, the process
abends. If ABORT^XFERERR is false, a file-system error is returned. In either case, the file in
question and all remaining SIO files are closed. If more than one file encounters an error and
if they all have ABORT^XFERERR set false, the error returned is that of the last file closed with
an error. In all cases where an error is returned by CLOSE^FILE on the common FCB, the
program can call CHECK^FILE with the FILE^ERROR operation. This operation can be performed
on each file FCB in turn to determine which files encountered an error.
If CLOSE^FILE returns an error 45 (file is full) for an EDIT file to which data was written, the
file will be corrupted because SIO will have been unable to write the appropriate data structures
to the end of the file.
Example
CALL CLOSE^FILE ( COMMON^FCB ); ! closes all files.
172 Guardian Procedure Calls (C)