Unformatted, indexed READ statements transfer binary data (without translation) between the current record and the entities specified in the I/O list. Only one record is read.
If the number of I/O list items is less than the number of fields in the record being read, the unused fields in the record are discarded. If the number of I/O list items is greater than the number of fields, an error occurs.
If a specified key value is shorter than the key field referenced, the key value is matched against the leftmost characters of the appropriate key field until a match is found. The record supplying the match is then read. If the specified key value is longer than the key field referenced, an error occurs.
If the file is connected for formatted I/O, unformatted data transfer is prohibited.
Examples
Suppose the following statements are specified:
OPEN (UNIT=3, STATUS='OLD',
1 ACCESS='KEYED', ORGANIZATION='INDEXED',
2 FORM='UNFORMATTED',
3 KEY=(1:5,30:37,18:23))
READ (3,KEY='SMITH') ALPHA, BETA
The READ statement reads from the file connected to I/O unit 3 and retrieves the record with the value 'SMITH' in the primary key field (bytes 1 through 5). The first two fields of the record retrieved are placed in variables ALPHA and BETA, respectively.
Suppose the following statement is specified:
READ (3,KEYGE='XYZDEF',KEYID=2,ERR=99) IKEY
In this case, the READ statement retrieves the first record having a value equal to or greater than 'XYZDEF' in the second alternate key field (bytes 18 through 23). The first field of that record is placed in variable IKEY.