next up previous

1 Overview of Fortran 90     continued...

Input and Output
Fortran 90 adds a few additional options to the comprehensive file connection capabilities of Fortran 77. One important example is the ACTION= open specifier, which allows a file to be connected as READ or WRITE or READWRITE. The major I/O additions in Fortran 90, however, are NAMELIST and nonadvancing I/O. NAME-LIST has long been included in many Fortran compilers; the standard has finally caught up to this common practice and has identified a standard form for NAMELIST from among the various existing versions. In addition to specifying a standard NAMELIST, its inclusion in Fortran 90 will insure that NAMELIST is available in all Fortran 90 compilers.

The other major I/O addition in Fortran 90 is nonadvancing I/O, which provides the functionality of reading or writing only part of a record. Recall that each formatted sequential READ or WRITE, the only form of I/O to which nonadvancing applies, in Fortran 77 causes (at least) one entire record to be read or written; that is, the file is always positioned between records after execution of a READ or WRITE statement. Non advancing I/O is different in that the file remains positioned after the last character transferred (effectively between characters in a record rather than between records)- a nonadvancing READ does not ``skip" to the end of the record and a nonadvancing WRITE does not terminate the record (i.e., does not write an end-of-record mark). The next READ or WRITE on that file starts where the last one left off. Nonadvancing I/O is specified by including ADVANCE='NO' in the control list of the READ or WRITE statement. For example, the following nonadvancing READ statement could be used to obtain the next character from the input terminal:

CHARACTER :: C
  ...  
  READ(*,`(A)',ADVANCE='NO',IOSTAT=IOS) C
  ...

Other forms of input/output considered for Fortran 90, but then not adopted, were asynchronous and parallel I/O and a variation of keyed access. Nor is there any direct database support in Fortran 90, though Fortran bindings exist to modern database facilities such as the structured query language (SQL) standard.