インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

OPEN: RECL Specifier

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. If rl is too large, you can exhaust your program's virtual memory resources trying to create room for the record.

The length specified is interpreted depending on the type of records in the connected file, as follows:

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:

Maximum Record Lengths (RECL)

Record Type

CARRIAGECONTROL

Formatted (size in bytes)

Fixed-length

'NONE'

Unlimited

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) 1

'FORTRAN'

2147483646 (2**31-2)

1 L*X only

The default value depends on the setting of the RECORDTYPE specifier, as shown in the following table:

Default Record Lengths (RECL)

RECORDTYPE

RECL value

'FIXED'

None; value must be explicitly specified.

All other settings

132 bytes for formatted records; 510 longwords for unformatted records.1

1To change the default record length values, you can use environment variable FORT_FMT_RECL or FORT_UFMT_RECL.

For formatted records with other than RECORDTYPE='FIXED', the default RECL is 132.

There is a property of list-directed sequential WRITE statements called the right margin. If you do not specify RECL as an OPEN statement specifier or in environmental variable FORT_FMT_RECL, the right margin value defaults to 80. When RECL is specified, the right margin is set to the value of RECL. If the length of a list-directed sequential WRITE exceeds the value of the right margin value, the remaining characters will wrap to the next line. Therefore, writing 100 characters will produce two lines of output, and writing 180 characters will produce three lines of output. You can turn off the right margin using the wrap-margin compiler option or the FORT_FMT_NO_WRAP_MARGIN environment variable.

See Also