如果我正确阅读了
VMS VAX FORTRAN手册,
'N
指定了单位
2
中第
N
条记录。来自Cl. 7.1.1.6“记录说明符”:
The record specifier identifies the number of the record you wish to access in a file with relative organization. It takes either one of the following forms:
REC = r
'r
r
Is a numeric expression with a value that represents the position in a direct access file of the record to be accessed. [...]
请注意,这不是符合标准的Fortran!大多数编译器将无法接受此语法。请改用
REC=...
:
WRITE(2, REC=N) (Y (I), I = 1, 5)
READ(2, REC=N, ERR = 48) (Y (I), I = 1, 5)
第2
单元的文件无需显式打开。这在同一文档Cl. 7.1.1.2“逻辑单元标识符”中有说明:
文件或设备被分配一个逻辑单元号的方式有两种:
- 通过OPEN语句显式指定[...]
- 由系统隐式指定[...]
在后一种情况下,使用的文件名在VAX Fortran用户手册的Cl. 4.2.2.1“FORTRAN逻辑名称”中定义:
VAX FORTRAN provides predefined logical names in the
following form:
FOR0nn[.DAT]
[...]
For example:
WRITE (17,200)
If you enter the preceding statement without including an
explicit file specification, the data is written to a file named
FOR017.DAT on your default disk under your default
directory.
大多数现代编译器会在这种情况下创建一个名为
fort.nn
的文件。