The OPEN statement connects an external file to a unit, creates a new file and connects it to a unit, creates a preconnected file, or changes certain properties of a connection. For more information, see OPEN.
The following table summarizes the OPEN statement specifiers and their values (and contains links to their descriptions):
Specifier |
Values |
Function |
Default |
---|---|---|---|
'SEQUENTIAL' 'DIRECT' 'APPEND' |
Access mode |
'SEQUENTIAL' |
|
(or MODE) |
'READ' 'WRITE' 'READWRITE' |
File access |
'READWRITE' |
var |
Next direct access record |
No default |
|
'NULL' 'ZERO' |
Interpretation of blanks |
'NULL' |
|
n_expr |
Physical block size |
Filesystem default |
|
n_expr |
Number of I/O buffers |
One |
|
'YES' 'NO' |
Buffering for WRITE operations |
'NO' |
|
'FORTRAN' 'LIST' 'NONE' |
Print control |
Formatted: 'LIST'1 Unformatted: 'NONE' |
|
'LITTLE_ENDIAN' 'BIG_ENDIAN' 'CRAY' 'FDX' 'FGX' 'IBM' 'VAXD' 'VAXG' 'NATIVE' |
Numeric format specification |
'NATIVE' |
|
c_expr |
Default file pathname |
Current working directory |
|
'APOSTROPHE' 'QUOTE' 'NONE' |
Delimiter for character constants |
'NONE' |
|
DISPOSE (or DISP) |
'KEEP' or 'SAVE' 'DELETE' 'PRINT' 'PRINT/DELETE' 'SUBMIT' 'SUBMIT/DELETE' |
File disposition at close |
'KEEP' |
label |
Error transfer control |
No default |
|
FILE (or NAME) |
c_expr |
File pathname (file name) |
fort.n 2 |
'FORMATTED' 'UNFORMATTED' 'BINARY' |
Format type |
Depends on ACCESS setting |
|
.TRUE. .FALSE. |
Active window in QuickWin application |
.TRUE.3 |
|
var |
I/O status |
No default |
|
n_expr |
Direct access record limit |
No limit |
|
No value |
File sharing disallowed |
L*X, M*X: SHARED W*32, W*64: Not shared |
|
'SEQUENTIAL' 'RELATIVE' |
File organization |
'SEQUENTIAL' |
|
'YES' 'NO' |
Record padding |
'YES' |
|
'ASIS' 'REWIND' 'APPEND' |
File positioning |
'ASIS' |
|
No value |
Write protection |
No default |
|
(or RECORDSIZE) |
n_expr |
Record length |
Depends on RECORDTYPE, ORGANIZATION, and FORM settings 5 |
'FIXED' 'VARIABLE' 'SEGMENTED' 'STREAM' 'STREAM_CR' 'STREAM_LF' |
Record type |
Depends on ORGANIZATION, CARRIAGECONTROL, ACCESS, and FORM settings |
|
'DENYRW' 'DENYWR'6 'DENYRD'6 'DENYNONE' |
File locking |
'DENYWR' 7 |
|
No value |
File sharing allowed |
L*X, M*X: SHARED W*32, W*64: Not shared |
|
STATUS (or TYPE) |
'OLD' 'NEW' 'SCRATCH' 'REPLACE' 'UNKNOWN' |
File status at open |
'UNKNOWN' 8 |
c_expr |
Title for child window in QuickWin application |
No default |
|
n_expr |
Logical unit number |
No default; an io-unit must be specified |
|
func |
User program option |
No default |
|
1 If you use the compiler option specifying OpenVMS defaults, and the unit is connected to a terminal, the default is 'FORTRAN'. 3 If unit '*' is specified, the default is .FALSE.; otherwise, the default is .TRUE.. 4 For information on file sharing, see Building Applications. 5 On Linux* and Mac OS* X systems, the default depends only on the FORM setting. 7 The default differs under certain conditions (see SHARE Specifier). 8 The default differs under certain conditions (see STATUS Specifier). |
|||
c_expr: A scalar default character expression func: An external function label: A statement label n_expr: A scalar numeric expression var: A scalar integer variable |
Building Applications for details on Fortran I/O status and IOSTAT values
Building Applications for details on OPEN statements and file connection