Indexed files
The number of character positions in record-name-1 can be different from the number of character positions in the record being replaced.
When the access mode is sequential, the record to be replaced is specified by the value contained in the prime RECORD KEY. When the REWRITE statement is executed, this value must equal the value of the prime record key data item in the last record read from this file.
Both the INVALID KEY phrase and an applicable EXCEPTION/ERROR procedure can be omitted.
When the access mode is random or dynamic, the record to be replaced is specified by the value contained in the prime RECORD KEY.
Values of ALTERNATE RECORD KEY data items in the rewritten record can differ from those in the record being replaced. The system ensures that later access to the record can be based upon any of the record keys.
If an invalid key condition exists, the execution of the REWRITE statement is unsuccessful, the updating operation does not take place, and the data in record-name-1 is unaffected. (See Invalid key condition under "Common processing facilities".)