Indicates the type of records in a file. It takes the following
form:
RECORDTYPE = typ
typ Is a character expression with one of the following
values:
'FIXED' All records are one size. Short records are padded
with blanks (formatted files) or zeros (unformatted
files).
'VARIABLE' Records can vary in length.
'SEGMENTED' A record consists of one or more variable length
records which may exist in different physical blocks.
Valid only for unformatted, sequential files with
sequential access.
'STREAM' Data is not grouped into records and contains no
control information.
'STREAM_CR' Variable-length records whose length is indicated by
carriage-returns embedded in the data.
'STREAM_LF' Variable-length records whose length is indicated by
line-feeds (new lines) embedded in the data.
When you open 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 is a logical record consisting of one or more
variable-length records (segments). The logical record can span
several physical records. Only unformatted sequential-access files
with sequential organization can have segmented records;
'SEGMENTED' must not be specified for any other file type.
Files containing segmented records can be accessed only by
unformatted sequential data transfer statements. You cannot use an
unformatted READ statement to access such a file, unless you
specify RECORDTYPE='SEGMENTED' in the OPEN statement.
Normally, if you do not use the RECORDTYPE specifier when you are
accessing an existing file, the record type of the file is used.
However, if the file is an unformatted sequential-access file with
sequential organization and variable-length records, the default
record type is 'SEGMENTED'.
If you use the RECORDTYPE specifier when you are accessing an
existing file, the type that you specify must match the type of the
existing file.
If an output statement does not specify a full record for a file
containing fixed-length records, the following occurs:
o In formatted files, the record is filled with blanks
o In unformatted files, the record is filled with zeros