## 7.4.1 Formatted REWRITE Statement

The formatted REWRITE statement performs the following operations:

- It retrieves binary values from internal storage.

- It translates those values to character form as specified by FORMAT.

- It writes the translated data to a current (existing) record in the following types of files:

  - On OpenVMS systems, in a file with any type of organization. (In sequential files, the new record must be the same length as the current record.)

  - On Tru64 UNIX systems, in a file with direct access.

  The current record is the last record accessed by a preceding, successful indexed (VMS only), direct access, or sequential READ statement.

Errors occur under the following conditions:

- If you attempt to rewrite more than one record in a single REWRITE statement operation

- If a record is too long (Unused space in a rewritten, fixed-length record is filled with spaces.)

- If the primary key (VMS only) value is changed

Example

In the following example, the REWRITE statement updates the current record contained in the relative organization file connected to logical unit 3 with the values represented by NAME, AGE, and BIRTH.

          REWRITE (3,10,ERR=99) NAME, AGE, BIRTH

    10    FORMAT (A16,I2,A8)

Previous Page Next Page Table of Contents