The RECL specifier indicates the length of each record in a file connected for direct access, or the maximum length of a record in a file connected for sequential access.
The RECL specifier takes the following form:
RECL = rl
rl
Is a positive numeric expression indicating the length of records in the file. If necessary, the value is converted to integer data type before use.
If the file is connected for formatted data transfer, the value must be expressed in bytes (characters). Otherwise, the value is expressed in 4-byte units (longwords).
If the file is connected for unformatted data transfer, the value can be expressed in bytes if compiler option assume byterecl is specified.
Except for segmented records, the rl is the length for record data only, it does not include space for control information.
The length specified is interpreted depending on the type of records in the connected file, as follows:
You can use the RECL specifier in an INQUIRE statement to get the record length before opening the file.
If you read a fixed-length file with a record length different from the one used to create the file, indeterminate results can occur.
The maximum length for rl depends on the record type and the setting of the CARRIAGECONTROL specifier, as shown in the following table:
Record Type | CARRIAGECONTROL | Formatted (size in bytes) |
---|---|---|
Fixed-length | 'NONE' | 2147483647 (2**31-1) 1 |
Variable-length | 'NONE' | 2147483640 (2**31-8) |
Segmented | 'NONE' | 32764 (2**15-4) |
Stream | 'NONE' | 2147483647 (2**31-1) |
Stream_CR | 'LIST' | 2147483647 (2**31-1) |
'FORTRAN' | 2147483646 (2**31-2) | |
Stream_LF | 'LIST' | 2147483647 (2**31-1) 2 |
'FORTRAN' | 2147483646 (2**31-2) | |
1 Subtract 1 if compiler option vms is used. 2 L*X only |
The default value depends on the setting of the RECORDTYPE specifier, as shown in the following table:
RECORDTYPE | RECL value | |
---|---|---|
'FIXED' | None; value must be explicitly specified. | |
All other settings | 132 bytes for formatted records; 510 longwords for unformatted records.1 | |
1 To change the default record length values, you can use environment variable FORT_FMT_RECL or FORT_UFMT_RECL. |
See Also: