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'

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)

1Subtract 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:

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. For example, you can write record lengths of 132 characters without a "maximum record length exceeded" error. However, after 80 characters, the remaining characters will wrap to the next line. Therefore, writing 100 characters will produce two lines of output. This is a property of terminal format files called the right margin. If you do not specify a RECL, this right margin is set to 80; otherwise, it is set to the value of the RECL.

See Also


Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.