Informix Error -1147: You cannot CLOSE, CLEAR or make CURRENT an unopened window.
Cause and resolution
You cannot CLOSE, CLEAR or make CURRENT an unopened window.
This CLOSE WINDOW, CLEAR WINDOW, or CURRENT WINDOW statement names a window that has not been opened or has been closed. Review the program logic to ensure that it does not refer to an unopened window except to open it.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1147 fires when CLOSE WINDOW, CLEAR WINDOW, or CURRENT WINDOW IS references a window that
hasn't been opened yet, or that was already closed — per the official guidance, these three
operations all require the window to actually be open.
- A window referenced before its
OPEN WINDOWstatement has run, per the official guidance — an ordering problem. - A window referenced after it was already closed, per the official guidance — a stale reference to a window no longer active.
Solutions / Resolution
- Review the program logic to prevent references to unopened windows, per the official
guidance, except during the
OPEN WINDOWoperation itself. - Track which windows are currently open in the program's control flow, so
CLOSE/CLEAR/CURRENT WINDOWare only issued against ones actually open at that point.
Examples
Referencing a window before opening it
CLEAR WINDOW w1
-- -1147: w1 has not been opened yet
OPEN WINDOW w1 AT 1, 1 WITH FORM "order_entry"
Diagnostic Checks
- Trace the program flow to confirm the window was opened, and not already closed, at the
point of the failing
CLOSE/CLEAR/CURRENT WINDOWstatement.
Related Errors / Related Topics
- -1143 — "Window is already open." The mirror-image restriction:
OPEN WINDOWfails when a window is already open, while this error fires when other operations target one that isn't.
CLOSE/CLEAR/CURRENT WINDOW all require the window to actually be open — check the program's
open/close ordering.