← All errors

RNQ

RNQ1211 I/O operation on a closed file

RPG status code
01211 I/O operation to a closed file.

Most common cause

READ, CHAIN or WRITE on a file declared USROPN that was never opened, or already closed.

Other causes

  • The OPEN failed earlier, but the error was not checked.
  • The file was closed by a clean-up procedure called earlier than expected.

How to fix it

Before the I/O check %OPEN(file) and open the file if needed. Handle the open error with OPEN(E).

Related errors

Text and codes from IBM documentation for 7.6. Checked on .