Before a DELETE or a REWRITE statement can be successfully executed in sequential access mode the last input-output statement
executed for the associated file must have been a successful read. In your code no read statement precedes your tried DELETE
or REWRITE.
Resolution:
When your program has terminated, recode your program, making sure that the last input-output statement to be executed before
the DELETE or REWRITE is a read statement.