6.1.30 Extended I/O specifiers
GNU Fortran supports the additional legacy I/O specifiers
SHARE with the
compile flag -fdec, for compatibility.
CARRIAGECONTROLspecifier allows a user to control line termination settings between output records for an I/O unit. The specifier has no meaning for readonly files. When
CARRAIGECONTROLis specified upon opening a unit for formatted writing, the exact
CARRIAGECONTROLsetting determines what characters to write between output records. The syntax is:
Where cc is a character expression that evaluates to one of the following values:
One line feed between records (default)
Legacy interpretation of the first character (see below)
No separator between records
CARRIAGECONTROL='FORTRAN', when a record is written, the first character of the input record is not written, and instead determines the output record separator as follows:
Leading character Meaning Output separating character(s)
Overprinting Carriage return only
New line Line feed and carriage return
Skip line Two line feeds and carriage return
New page Form feed and carriage return
Prompting Line feed (no carriage return)
Overprinting (no advance) None
READONLYspecifier may be given upon opening a unit, and is equivalent to specifying
ACTION='READ', except that the file may not be deleted on close (i.e.
STATUS="DELETE"). The syntax is:
SHAREspecifier allows system-level locking on a unit upon opening it for controlled access from multiple processes/threads. The
SHAREspecifier has several forms:
OPEN(..., SHARE=sh) OPEN(..., SHARED) OPEN(..., NOSHARED)
Where sh in the first form is a character expression that evaluates to a value as seen in the table below. The latter two forms are aliases for particular values of sh:
Explicit form Short form Meaning
Exclusive (write) lock
Shared (read) lock
In general only one process may hold an exclusive (write) lock for a given file at a time, whereas many processes may hold shared (read) locks for the same file.
The behavior of locking may vary with your operating system. On POSIX systems, locking is implemented with
fcntl. Consult your corresponding operating system’s manual pages for further details. Locking via
SHARE=is not supported on other systems.