The REWRITE statement logically replaces a record existing in a disk file.
record-name and identifier must not reference the same storage area.
However, it can be specified for
an indexed file in sequential access mode.
MOVE identifier TO record-name
followed by the execution of the same REWRITE statement without the FROM phrase. The contents of the record area prior to the execution of the implicit MOVE statement have no effect on the execution of the REWRITE statement.
Note: We recommend that you do not use the REWRITE statement on compressed sequential files because a REWRITE operation will only succeed if the length of the compressed new record is the same as the length of the compressed old record.
The updating operation does not take place and the data in the record area is unaffected. (See the topic The INVALID KEY Condition in the chapter Procedure Division.)