OPEN Statement

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 in the A to Z Reference.

The following table summarizes the OPEN statement specifiers (and contains links to their descriptions):

OPEN Statement Specifiers and Values on Windows, Tru64 UNIX, and Linux Systems

Specifier  Values  Function  Default 
ACCESS 'SEQUENTIAL'
'DIRECT'
'APPEND'
 
Access mode  'SEQUENTIAL'  
ACTION
(or MODE 1)  
'READ'
'WRITE'
'READWRITE'  
File access  'READWRITE'  
ASSOCIATEVARIABLE var   Next direct access record  No default 
BLANK 'NULL'
'ZERO'  
Interpretation of blanks  'NULL'  
BLOCKSIZE n_expr   Physical block size  Filesystem default 
BUFFERCOUNT n_expr   Number of I/O buffers  One 
BUFFERED  'YES'
'NO' 
Buffering for WRITE operations  'NO' 
CARRIAGECONTROL 'FORTRAN'
'LIST'
'NONE'
 
Print control  Formatted: 'LIST' 2
Unformatted: 'NONE'  
CONVERT 'LITTLE_ENDIAN'
'BIG_ENDIAN'
'CRAY'
'FDX'
'FGX'
'IBM'
'VAXD'
'VAXG'
'NATIVE'
 
Numeric format specification   'NATIVE'  
DEFAULTFILE c_expr  Default file pathname  Current working directory 
DELIM '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'  
ERR label  Error transfer control  No default 
FILE
(or NAME)  
c_expr  File pathname (file name)   fort.n 3 
FORM 'FORMATTED'
'UNFORMATTED'
'BINARY' 1  
Format type  Depends on ACCESS setting 
IOFOCUS 1   .TRUE. or .FALSE.  Active window in QuickWin application  .TRUE. 4 
IOSTAT var  I/O status  No default 
MAXREC n_expr  Direct access record limit  No limit 
ORGANIZATION 'SEQUENTIAL'
'RELATIVE'
 
File organization   'SEQUENTIAL'  
PAD 'YES'
'NO'  
Record padding  'YES' 
POSITION 'ASIS'
'REWIND'
'APPEND'  
File positioning  'ASIS' 
READONLY No value  Write protection  No default 
RECL
(or RECORDSIZE) 
n_expr   Record length  Depends on RECORDTYPE, ORGANIZATION, and FORM settings 5 
RECORDTYPE 'FIXED'
'VARIABLE'
'SEGMENTED'
'STREAM'
'STREAM_CR'
'STREAM_LF'
 
Record type  Depends on ORGANIZATION, CARRIAGECONTROL, ACCESS, and FORM settings 
SHARE 1, 6  'DENYRW'
'DENYWR'
'DENYRD'
'DENYNONE'
 
File locking   'DENYWR'  
SHARED 6 No value  File sharing allowed  U*X: SHARED 
WNT and W9*: No default
STATUS (or TYPE)   'OLD'
'NEW'
'SCRATCH'
'REPLACE'
'UNKNOWN'  
File status at open   'UNKNOWN' 7 
TITLE 1 c_expr  Title for child window in QuickWin application  No default 
UNIT n_expr  Logical unit number  No default; an io-unit must be specified 
USEROPEN func   User program option  No default 
1 WNT, W95
2 If you use the compiler option specifying OpenVMS defaults, and the unit is connected to a terminal, the default is 'FORTRAN'.
3 n is the unit number.
4 If you specify unit '*' the default is .FALSE..
5 On Tru64 UNIX and Linux systems, the default depends only on the FORM setting.
6 For information on file sharing, see your user manual or programmer's guide.
7 The default differs under certain conditions (see STATUS Specifier).
Key to Values
   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
   

For More Information: