7.2.1.4 Unformatted Sequential READ Statement

The unformatted sequential READ statement reads an external record accessed under the keyed (VMS only) or sequential mode of access; it assigns the fields of binary data contained in that record to the elements in the I/O list, in the order, from left to right, in which those elements appear in the list. The data is not translated and the amount of data assigned to each element is determined by the element's data type.

The unformatted sequential READ statement reads s single record. If the I/O list does not use all of the values in a record, the remainder of the record is discarded; this happens when there are more values in the record than elements in the list. If the number of list elements is greater than the number of values in the record, an error occurs.

If a statement contains no I/O list, it skips over one full record, positioning the file to read the following record on the next execution of a READ statement.

Examples

In the following example, the READ statement reads one record from the file connected to logical unit 1 and assigns values of binary data to variables FIELD1 and FIELD2, in that order.

READ (UNIT=1) FIELD1, FIELD2

In the following example, the READ statement advances the file connected to logical unit 8 by one record.

READ (8)


Previous Page Next Page Table of Contents