This routine replaces an existing record in the file. It has four parameters: file_handle, record, length, and keyval.

file_handle    must be a valid file handle returned by R-OPEN-FUNCTION.
record is the record data to write to the file.
length is the number of bytes to write (for variable-length files).
keyval is the record number to write. A keyval of -1 means to write at the end of the file.

The R-REWRITE-FUNCTION routine does not change the current file position.