Use Unformatted Files Instead of Formatted Files

Use unformatted files whenever possible. Unformatted I/O of numeric data is more efficient and more precise than formatted I/O. Native unformatted data does not need to be modified when transferred and will take up less space on an external file.

Conversely, when writing data to formatted files, formatted data must be converted to character strings for output, less data can transfer in a single operation, and formatted data may lose precision if read back into binary form.

To write the array A(25,25) in the following statements, S1 is more efficient than S2:

  S1         WRITE (7) A

  S2         WRITE (7,100) A
       100   FORMAT (25(' ',25F5.21))

Although formatted data files are more easily ported to other systems, Visual Fortran can convert unformatted data in several formats (see Converting Unformatted Numeric Data).