### 7.2.3.1 Formatted Indexed READ Statement (VMS only)

The formatted indexed READ statement performs the following operations:

- It reads character data from one or more external records accessed under the keyed mode of access.

- It translates the data from character to binary form by using format specifications to provide editing.

- It assigns the translated data to the elements in the I/O list in the left-to-right order in which the elements appear.

Use the formatted indexed READ statement on indexed files only. If the I/O list and format specifications specify that additional records are to be read, the statement reads those additional records sequentially by using the current key-of-reference value.

If the KEYID parameter is omitted, the key of reference remains unchanged from the most recent specification. If the KEYID parameter is omitted from the first keyed read, the key of reference is the primary key.

If the specified key value is shorter than the key field that is referred to, 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 key value is longer than the key field that is referred to, an error occurs.

Example

In the following example, the READ statement retrieves a record with a key value of 'ABCD' in the primary key from the file connected to logical unit 3, and then uses the format contained in the array item KAT(25) to read the first four fields from the record into variables A,B,C, and D.

    READ (3,KAT(25),KEY='ABCD')  A,B,C,D

Previous Page Next Page Table of Contents