## 13.6.23 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. (For the correct form of this option, see your user manual or programmer's guide.)

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:

- For segmented records, RECL indicates the maximum length for any segment (including the four bytes of control information).
- For fixed-length records, RECL indicates the size of each record; it must be specified. If the records are unformatted, the size must be expressed as an even multiple of four.

  You can use the RECL specifier in an INQUIRE statement to get the record length before opening the file (see Section 13.5.26).

- For variable-length records, RECL indicates the maximum length for any record.

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 Table 13-2.

Table 13-2 Maximum Record Lengths (RECL) on Tru64 UNIX, Linux, and Windows Systems

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 the compiler option specifying OpenVMS defaults is used. 2 U*X only

The default value depends on the setting of the RECORDTYPE specifier, as shown in Table 13-3.

Table 13-3 Default Record Lengths (RECL) on Tru64 UNIX, Linux, and Windows Systems

RECORDTYPE | RECL value
--- | ---
'FIXED' | None; value must be explicitly specified.
All other settings | 132 bytes for formatted records; 510 longwords for unformatted records.

Previous Page Next Page Table of Contents