WRITE record-buff
WRITE indexed-record
WITH LOCK
ON INVALID KEY
DISPLAY "Key exists, REWRITING..." END-DISPLAY
PERFORM rewrite-key
END-WRITE
IF indexed-file-status NOT EQUAL ZERO THEN
DISPLAY "Write problem: " indexed-file-status UPON SYSERR
...