OPEN statement
Standard: F77 F90 F95 F2003 F2008
  Example Program
OPEN ( open-spec [ , open-spec ]... )

The possible open-specs are listed in the table in the section below. In UNIT=, the keyword and equals sign may be omitted if it is the first open-spec.
The OPEN statement connects a file to a unit with the specified properties. The meaning of each open-spec specifier is as follows. Specifiers whose values are indicated as variable must be variables; all other non-label specifier values may be expressions. Note that upper case and lower case are considered the same in all input/output specifier values.

Specifier Argument Meaning Values
[ UNIT= ] Integer Unit to connect to
FILE= Character File to connect
ACCESS= Character Access mode 'DIRECT', 'SEQUENTIAL', 'STREAM'
ACTION= Character Permitted actions 'READ', 'WRITE', 'READWRITE'
ASYNCHRONOUS= Character Asynchronous input/output? 'YES', 'NO'
BLANK= Character Blank mode 'NULL', 'ZERO'
DECIMAL= Character Decimal edit mode 'COMMA', 'POINT'
DELIM= Character String delimiter 'QUOTE', 'NONE', 'APOSTROPHE'
ENCODING= Character File encoding 'ASCII', 'DEFAULT', 'SHIFT_JIS', 'UTF-8'
ERR= Label Branch on error
FORM= Character Formatting 'FORMATTED', 'UNFORMATTED'
IOMSG= Character Error message variable
IOSTAT= Integer Error status variable
NEWUNIT= Integer New unit number variable
PAD= Character Pad short records with blanks? 'YES', 'NO'
POSITION= Character Initial file position 'APPEND', 'ASIS', 'REWIND'
RECL= Integer Length of record in bytes Greater than zero
SIGN= Character Sign edit mode 'PLUS', 'SUPPRESS', 'PROCESSOR_DEFINED'
STATUS= Character File status 'NEW', 'OLD', 'REPLACE', 'SCRATCH', 'UNKNOWN'

If the unit is already open to a different file, that file is closed automatically. If the unit is already open to the same file, only the BLANK=, DECIMAL=, DELIM=, PAD= and SIGN= may have values different from the current mode.

Fortran 2003 has stream files (ACCESS='STREAM') and the additional specifiers DECIMAL=, ENCODING=, IOMSG=, ROUND= and SIGN=.
ASYNCHRONOUS= specifier, BACKSPACE statement, CLOSE statement, CONVERT= specifier, DECIMAL= specifier, ENCODING= specifier, ENDFILE statement, ERR= specifier, INQUIRE statement, IOMSG= specifier, IOSTAT= specifier, NEWUNIT= specifier, PRINT statement, READ statement, REWIND statement, ROUND= specifier, SIGN= specifier, UNIT= specifier, WRITE statement