# OPEN: FORM Specifier

The FORM specifier indicates whether the file is being connected for formatted, unformatted, or binary (W*S) data transfer. It takes the following form:

FORM = fm

fm | Is a scalar default character expression that evaluates to one of the following values:
'FORMATTED' | Indicates formatted data transfer
'UNFORMATTED' | Indicates unformatted data transfer
'BINARY' | Indicates binary data transfer

The default is 'FORMATTED' for sequential access files, and 'UNFORMATTED' for direct access files.

The data is stored and retrieved in a file according to the file's access (set by the ACCESS specifier) and the form of the data the file contains.

A formatted file is a sequence of formatted records. Formatted records are a series of ASCII characters terminated by an end-of-record mark (a carriage return and line feed sequence). The records in a formatted direct-access file must all be the same length. The records in a formatted sequential file can have varying lengths. All internal files must be formatted.

An unformatted file is a sequence of unformatted records. An unformatted record is a sequence of values. Unformatted direct files contain only this data, and each record is padded to a fixed length with undefined bytes. Unformatted sequential files contain the data plus information that indicates the boundaries of each record.

Binary sequential files are sequences of bytes with no internal structure. There are no records. The file contains only the information specified as I/O list items in WRITE statements referring to the file.

Binary direct files have very little structure. A record length is assigned by the RECL specifier in an OPEN statement. This establishes record boundaries, which are used only for repositioning and padding before and after read and write operations and during BACKSPACE operations. Record boundaries do not restrict the number of bytes that can be transferred during a read or write operation. If an I/O operation attempts to read or write more values than are contained in a record, the read or write operation is continued on the next record.

Fortran standard stream access provides similar functionality to FORM='BINARY'. This is specified using ACCESS='STREAM'.

Parent topic: OPEN Statement Specifiers

## See Also

Record Access