9.6.24 RECORDTYPE Keyword

The RECORDTYPE keyword specifies the format of records in a file: fixed-length records, variable-length records, segmented records, or stream-type variable-length records. It takes the following form:

RECORDTYPE = typ
typ
Is a character expression with one of the following values:

  • 'FIXED'

  • 'VARIABLE'

  • 'SEGMENTED'

  • 'STREAM'

  • 'STREAM_CR'

  • 'STREAM_LF'

When you create a file, default record types are as follows:

File Type  Default Record Type 
Relative or indexed files  'FIXED'  
Direct access sequential files  'FIXED'  
Formatted sequential access files   'VARIABLE'  
Unformatted sequential access files   'SEGMENTED'  

A segmented record consists of one or more variable-length records. Using segmented records allows a Fortran logical record to span several physical records. Only unformatted sequential access files with sequential organization can use segmented records. You cannot specify 'SEGMENTED' for any other file type.

If you do not specify the RECORDTYPE keyword when you are accessing an existing file, the record type of the file is used-except for unformatted sequential-access files with sequential organization and variable-length records. These files have a default of 'SEGMENTED'.

If you do specify the RECORDTYPE keyword when you are accessing an existing file, the type that you specify must match the type of an existing file.

In fixed-length record files, if an output statement does not specify a full record, the record is filled with spaces in a formatted file and zeros in an unformatted file.

You cannot use an unformatted READ statement to access an unformatted sequential organization file containing variable-length records, unless you specify the corresponding RECORDTYPE value in your OPEN statement.

Files containing segmented records can be accessed only by unformatted sequential Fortran I/O statements.

For More Information:

For details on record types, see your user manual.


Previous Page Next Page Table of Contents