Skip to main content

Commands and Functions


All of these commands use the WRITE /<mnemonic> syntax. For basic information on this syntax, see the Overview of I/O Commands in the Caché I/O Device Guide, and the WRITE command in the Caché ObjectScript Reference.


This command tells the system which kind of terminal will be used. It must be one of the terminals listed in the ^%SYS("tercap") global (Caché comes with some of the more common types already defined but the user may create descriptions for other terminals as well). Issuing this command will trigger the following actions:

  • Load a local table with the terminal capabilities

  • The initialization string is sent to the terminal so that it behaves in a predictable way, compatible with the character windows mode.

Here are some examples:

   W /INIT ; same as W /INIT("Terminal")
   W /INIT("vt100")
   W /INIT("vt320")

When you have finished working with characters windows and want to restore the terminal to its state prior to the /INIT, the /END command should be issued .


After establishing the mnemonic space and specifying a terminal type, one must set the proper compatibility mode for the character windows subsystem, according to the table below.

Mode Meaning
-1 Disable the character windows subsystem and continue operating without this feature. This is a termination mode.
0 DataTree/DTM compatibility mode.
1 Ipsum MUMPS compatibility mode.
2 Extensao SuperMUMPS compatibility mode.

If you change the mode with windows open:

  • All windows are closed.

  • If the new mode is not -1, the base window is opened. It fills the whole screen and has no border.




Open a window with the following parameters:



wid Window identification (> 0)
Ipsum mode: The programmer must provide a unique numeric ID > 0 for each window.
Other modes: The system chooses an internal window ID and so the parameter is not present.
col Character column on the screen for the left edge of the client area.
line Line on the screen for the top of the client area.
width Client area dimensions: width in character columns.
height Client area dimensions: height is number of lines.
border Border style, according to DTM conventions:
0 - none
1 - single line
2 - double line
3 - bold line
4 - blocks
5 - light dots
6 - dark dots
7 - light bar
8 - medium bar
9 - heavy bar
10 - ASCII graphics ('-', '|' and '+')
Default = 0. The actual characters that will show up in the terminal depend on the output translation table and on the codes chosen for the border characters by the user (more later).
attr Window attribute.
Possible attributes are "/hon", "/ron", "/uon", "/bon", "/hoff", "/boff", "/uoff", and "/roff". See Terminal Functions for details. Default = "" (none).
battr Border attribute. Same conventions as attr.
caption Window caption (does not appear if border style is none (0)). Default = "" (none).
cpos Caption position:
"tl" Top left
"tc" Top center
"tr" Top right
"bl" Bottom left
"bc" Bottom center
"br" Bottom right
"l" Bottom and top left
"c" Bottom and top center
"r" Bottom and top right
Default = "". If both a top and a bottom caption are desired, then the caption parameter is of the form "top caption:bottom caption".
wfc Window foreground color. Default = current color.
wbc Window background color. Default = current color.
bfc Border foreground color. Default = current color.
bbc Border background color. For all color parameters, black is assumed to be 0 and white 7. Default = current color.

Closes the active window (always the topmost). The screen characters hidden by this window are restored. The next window in z-order is made active.


Selects window wid to be the active window. This window is brought to the surface even if it has been hidden by other windows.




Draws a rectangle as if a new window was being opened. This is, however, only a visual effect, and a /WCLOSE should not be called to "close" this pseudo-window. Coordinates are relative to the current frame in the active window. Other parameters are the same as those of /WOPEN.




Defines new limits (a new frame) for the active window, normally for temporary use. A new border may be drawn for the new area, if and only if the active window also has a border. The values of col and line are relative to the current window. To restore the initial limits of the active window, call /WLIM.




Draws a box with the upper left corner at (x1,y1) and lower right corner at (x2,y2), filled with character char. The corner positions are relative to the current frame in the active window. The border style and other parameters are the same as described under /WOPEN. If the char parameter is omitted, no filling is performed.




Fills the rectangle with upper left corner at (x1,y1) and lower right corner at (x2,y2) with character char and color wfc, wbc.


Forces a screen update. May be called if the programmer wants to see the individual effects of /WOPEN and /WCLOSE commands, which otherwise would be combined and only the final image displayed.


Contains a control sequence to be sent to the terminal when exiting Caché. Use this to restore the terminal to its configuration prior to starting Caché. Also frees the terminal capabilities table and disables the I/O translation. If the previous translation table needs to be restored, it must be done by explicit programming. It must be saved before calling /INIT and restored after /END.

Window Status

You can use the $$ZWSTATUS^%CHARWIN() extrinsic function and $$ZWSTATUS^%CHARWIN extrinsic special variable to obtain information about windows in use.

$$ZWSTATUS^%CHARWIN(wid) Function

This function works the same in all language modes. It returns the status of the window whose identification number is wid. If the window specified by wid is not open, then all fields return -1.

The status is described by a string containing the following fields, separated by semicolons:


The fields specify the following values:

col;line Upper left corner of the window.
width;height Window dimensions.
border Border style.
attr Window attribute.
battr Border attribute.
curcol;curline Current cursor position.
curattr Current character attributes.

The attribute fields return strings such as "/hon", "/aoff", and so on. See /WOPEN for a list of attributes.

$$ZWSTATUS^%CHARWIN special variable

The $$ZWSTATUS^%CHARWIN special variable value varies depending on language mode.

  • DTM mode — returns a null string.

  • Ipsum mode — returns the number of the current window, or zero if no window is open.

  • SuperMUMPS mode — returns a string of fields separated by commas, equivalent to the $ZWINDOW SuperMUMPS special variable:


    The fields specify the following values:

    winline,wincol Upper left corner of the active window.
    winheight,winwidth Active window dimensions.
    limline,limcol Upper left corner of the current limits, relative to the window area.
    limheight,limwidth Current limits dimensions.
    curline,curcol Current cursor position.
    curst Cursor status (0=off, 1=on)
    border Border style.
    attr Current video attributes. The attribute fields return strings such as "/hon", "/aoff", and so on. See /WOPEN for a list of attributes.
    visib Window visibility (0=invisible, 1=visible).
    proc Current process number.
    wid Active window identification number.
FeedbackOpens in a new tab