File Organization

File
organization refers to the way records are physically arranged
on a storage device.

Intel Fortran supports two kinds of file
organization:

Sequential

Relative

The default file organization is always
ORGANIZATION= 'SEQUENTIAL' for an OPEN statement. The organization of
a file is specified by means of the ORGANIZATION specifier in the OPEN
statement.

You can store sequential files on magnetic
tape or disk devices, and can use other peripheral devices, such as terminals,
pipes, and line printers as sequential files.

You must store relative files on a disk
device.

Sequential Organization

A sequentially organized file consists
of records arranged in the sequence in which they are written to the file
(the first record written is the first record in the file, the second
record written is the second record in the file, and so on). As a result,
records can be added only at the end of the file.

Sequential files are usually read sequentially,
starting with the first record in the file. Sequential files with a fixed-length
record type that are stored on disk can also be accessed by relative record
number (direct access).

Relative Organization

Within a relative file are numbered positions,
called cells. These cells are of fixed equal length and are consecutively
numbered from 1 to n, where 1
is the first cell, and n is the
last available cell in the file. Each cell either contains a single record
or is empty.

Records in a relative file are accessed
according to cell number. A cell
number is a record's relative record number (its location relative to
the beginning of the file). By specifying relative record numbers, you
can directly retrieve, add, or delete records regardless of their locations
(direct access). (Detecting deleted records is only available if you specified
the -vms option
when the program was compiled.)

When creating
a relative file, use the RECL value to determine the size of the fixed-length
cells. Within the cells, you can store records of varying length, as long
as their size does not exceed the cell size.