The CLOSE WINDOW Statement

Format:

CLOSE WINDOW window-save-area

Syntax Rules:

  1. window-save-area must be an elementary data item described with a PIC X(10) clause. It must have been the object of a POP-UP AREA phrase in a DISPLAY WINDOW statement.

General Rules:

  1. The CLOSE WINDOW statement is used to remove popup windows created by the POP-UP AREA option of the DISPLAY WINDOW statement.
  2. window-save-area must have been the object of a POP-UP phrase of a DISPLAY WINDOW statement that has been executed in this run unit. Furthermore, since that execution, it must not have been the object of a CLOSE WINDOW statement, nor can it have been modified by any other statement. Violation of these rules causes undefined results.
  3. The CLOSE WINDOW statement restores the contents of the terminal screen that was in the active window when the corresponding DISPLAY WINDOW statement executed. In other words, the window that was created by that DISPLAY WINDOW statement is removed from the screen and replaced by the contents of the screen which were under that popup window.
  4. The window that was active when the corresponding DISPLAY WINDOW statement executed becomes the active window, thereby becoming the top window and overlaying any other windows that might be present.

Comments:

The current window is selected by closing windows identified by their respective window-save-area data items, as in the following example:

If five popup windows are created, a, b, c, d and e in that order:

  • If d is closed, c becomes current.
  • If b is then closed, a becomes current.
  • If e is subsequently closed, c becomes current again.