When you decide how to move data from an EBCDIC system to an ASCII system, consider
the structure of the EBCDIC source file. On EBCDIC systems, you
might have files with fixed-length records or files with variable-length records.
Either type of file contains a header with information about the file. The header
includes a Record Format attribute that indicates whether the records are fixed length
or variable length. The header for a file with fixed-length records includes a Logical
Record Length attribute that indicates the length of each record in bytes.
In SAS, the Record Format
attribute corresponds to the RECFM= option in a FILENAME statement.
To access a file with fixed-length records, specify RECFM=F. To access
a file with variable-length records, specify RECFM=V. Similarly, the
Logical Record Length attribute corresponds to the LRECL= option.
The Logical Record Length
attribute in the header for a file with variable-length records indicates
the maximum record length. Each record in a file with variable-length
records begins with a record descriptor word (RDW). The RDW is a 4-byte binary integer field. The first two bytes of the RDW indicate
the length of the current
record. The last two bytes of the RDW contain information that is used by the operating
system. The length of the record includes the four bytes of the RDW at the beginning
of the record. Because the length of each record is specified in an EBCDIC file (either
in the header or in the RDW), there are no end-of-record indicators
in EBCDIC files.
A file with variable-length
records also contains block descriptor words (BDWs). Like the RDW, the BDW is a 4-byte, binary integer field. The first two bytes indicate
the block size, and the last two bytes
are used by the operating system. Each block can contain multiple records. If the
block size is not specified when the file is created, the default block size is the
logical record length plus 4. Otherwise, the size of a block is the number of bytes
that are contained in the block. This value is the sum of the record lengths in the
block (obtained from the RDWs) plus 4 (the length of the BDW).