REWRITE-FUNCTION (op-code 10)

This routine replaces an existing record in the file. The REWRITE routine has three parameters, f, record, and size.

F must be a valid file handle returned by OPEN.
Record     points to the new record to place in the file.
Size may be zero to indicate the maximum record size for the file. The record replaced is specified by the primary key value found in record. The size of the new record need not match the size of the existing record.

For keys that are unchanged between the new record and the old record, the ordering of those keys is unchanged. For keys that have changed, the new keys are placed at the end of the sequence of keys that have the same value. If any of the changed keys match keys that already exist in the file (and these keys allow duplicates), then F-ERRNO is set to W-DUP-OK. Note that these rules depend on the host system and may be different for some file systems.

The REWRITE routine does not affect the file position or the current key of reference.