VMS Help  —  FORTRAN  Statements  CLOSE
  Closes a file.  Statement format:

     CLOSE ([UNIT=]io-unit[,p][,ERR=label][,IOSTAT=i-var])

     io-unit Is an integer variable or constant specifying the
             logical unit number of the file, optionally prefaced
             by UNIT=.  UNIT= is required if unit is not the
             first I/O specifier.

     p       Is the disposition of the file after closing, prefaced
             by STATUS=, DISPOSE= or DISP=.  Dispositions are as
             follows:

             'KEEP'             Retains the file.
                               *DEFAULT FOR ALL BUT SCRATCH FILES*
             'SAVE'             Retains the file.
             'DELETE'           Deletes the file (unless OPEN(READONLY)
                                is specified).
                               *DEFAULT FOR SCRATCH FILES*
             'PRINT'            Submits the file as a print job.
             'PRINT/DELETE'     Submits the file as a print job,
                                then deletes it.
             'SUBMIT'           Submits the file as a batch job.
             'SUBMIT/DELETE'    Submits the file as a batch job,
                                then deletes it.

      label  Is the label of an executable statement that
             receives control if an error occurs.

      i-var  Is a scalar integer variable. (Returns a
             zero if no error condition exists or a positive
             integer if an error condition exists.)

  The CLOSE statement specifiers can appear in any order.  An I/O
  unit must be specified, but the UNIT specifier is optional if the
  unit specifier is the first item in the I/O control list.

  The status specified in the CLOSE statement supersedes the status
  specified in the OPEN statement, except that a file opened as a
  scratch file cannot be saved, printed, or submitted, and a file
  opened for read-only access cannot be deleted.

  If a CLOSE statement is specified for a unit that is not open, it
  has no effect.
Close Help