PETs - Adding Windows and Mouse Clickability to 3270 VM/CMS Applications


Richard G. Ellis, University of Connecticut, (

(C) Copyright 1999, Richard G. Ellis


PC and workstation GUI interfaces are desirable in part because they

  • support dialog boxes and other pop-up windows,
  • are controlled by clicking with a mouse,
  • offer a "graphic" rather than a "text" look-and-feel.

Applications written to use the "classic" 3270 text interface can be improved through the use of CMS windows and by allowing mouse clicks to navigate through such applications. Users interact with this hybrid interface ("Pointer Enabled 3270") either by pressing keys on a standard keyboard or by pointing and clicking with a PC or workstation mouse. VM/CMS provides the necessary REXX-callable commands, and numerous 3270 emulators can be easily configured to enable mouse clicks to be passed to the CMS applications. Writing standard CMS applications which can be manipulated with a mouse may at first seem a rather daunting task; but in reality, the technical difficulties are relatively minor and quickly mastered.

This essay introduces the mechanics of creating applications which use CMS windows and which respond to mouse clicks from an appropriately configured 3270 emulator. The applications illustrated here, which were written to be manipulated with a mouse, are referred to as PETs or Pointer Enabled Tools.

Displaying Text in CMS Windows

CMS windows are defined, initialized, displayed, deleted, and otherwise manipulated using the CMS commands, VSCREEN (virtual screen) and WINDOW. CMS Help files and other documentation can be reviewed for details.



A virtual screen is a "presentation space" which holds text intended for display on a real 3270 terminal screen. A virtual screen can contain fewer than, more than, or the same number of lines of text as a real 3270 screen. Unlike a real 3270 display, however, a virtual screen might contain thousands of lines of text. Further, a virtual screen can be defined as 80 columns/characters wide, but it can also be defined as narrower or wider than 80 columns.

A virtual screen is defined with the VSCREEN command. For example,



    SCRNNAME is a specific name assigned to this virtual screen
    32 is the number of lines in the virtual screen
    80 is the number of columns in the virtual screen
    1  is the number of "reserved lines" at the top of the virtual screen
    2  is the number of "reserved lines" at the end of the virtual screen

In this case, the virtual screen is defined to have the same number of lines and columns as does a real 327x Model 3 terminal (32 lines, 80 columns).

The VSCREEN command is also used to queue text to a virtual screen. For example,

    'VSCREEN WRITE SCRNNAME 10 1 80 (FIELD These 80 bytes go on line 10.'

A CMS window provides access to text stored in a virtual screen. A CMS window is defined, opened, closed, deleted, and otherwise manipulated with the WINDOW command.

Samples of CMS Windows Displayed by PETs

Virtual screens and windows can contain all manner of text. In the following 3270 screen image, a list of CP and CMS commands is displayed in a CMS window. In this particular application, a command is invoked by positioning the 3270 cursor on a menu item and pressing the ENTER key. If a PC or workstation 3270 emulator is properly configured, the same result is achieved by pointing and clicking with the workstation mouse.


The PF key help text toward the bottom of the window can be clicked on to activate the PF keys. And selecting PF3 or clicking outside the window closes the window and terminates the application.

Of course, applications can be written which open numerous CMS windows. Colors can be added to achieve special effects.


And with a little imagination and some Xedit-oriented coding techniques, mouse clickable windows and other functions can be developed to perk up Xedit. In the following example, pressing PF1 (or clicking on its help text in the reserved line) brings up a clickable menu of Help options and other useful commands.


The Role of 3270 Terminal Emulation Software

A rather large number of 3270 terminal emulators exist. The author has downloaded and exercised more than 20 products or versions of products to determine how well they worked with pointer enabled 3270 applications. These products typically emulate all standard 3270 terminals, including terminals supporting color and extended attributes. In most cases, these products also allow at least some customization of the mouse action.

PETs are written to respond to the location of the cursor when the ENTER key is pressed. Consequently, a mouse click which positions the 3270 cursor and then emulates pressing the ENTER key, such a mouse click can activate any positional control built into a CMS application.

Since PETs are designed to work even with fixed function ("dumb") terminals, all 3270 emulators work at least as well with PETs as do real 3270 devices. About half of all emulators tested also allowed a mouse action (one clicking the right mouse button, for example) to emulate the required actions, "set cursor" and "press ENTER." Some emulators offer this functionality by default, others require a degree of configuration.

The Role of REXX

PETs are written in Classic REXX on VM/CMS. Most of these programs follow a common logic.

    Define and initialize virtual screen(s) and CMS window(s)
       Update virtual screen(s) and the real 3270 screen
       Receive and analyze keystrokes and/or mouse clicks
       Perform the required function (or leave the loop)
       Queue new text to the virtual screen(s)
       Continue loop
    Delete virtual screen(s) and CMS window(s)

Xedit macros, also written in REXX, turn Xedit reserved line PF key help text of the form,

    1=Help 2=Addline 3=Quit ...

into mouse clickable "hot spots" which invoke the functions assigned to those PF keys. Other macros provide pop-up windows of subcommands, convert the prefix area into a "scroll bar," and even permit rearranging text on the screen simply by clicking with a mouse.

Why Add Windows and Mouse Control to 3270 Applications?

VM/CMS has supported 3270 style windows since the 1980's, and some commercial applications (e.g., Mailbook, Bookmanager) have made use of them to good advantage. Pop-up menus and input dialog boxes make these applications more appealing--if not more functional--than non-windowed applications. But windowing alone is not enough, since users continue to navigate these applications with keystrokes.

Like it or not, most people are more productive if they can use a mouse to select functions, files, and programs. Compared to keyboarding, mouse control is considerably faster, results in fewer errors, and is less frustrating for many people. A rich set of mouse-friendly Pointer Enabled Tools would make VM/CMS (and other 3270-based interactive environments) significantly easier to manage for casual and novice users, as well as the more experienced. Enabling 3270 applications for windows and mouse clicks satisfies two of the major reasons why GUI interfaces are popular.

And this interface is fast and easily developed.


Images included in this essay were created using Windows 95 and Word (Microsoft), and TCP3270 (McGill University). Text and HTML markup was entered using Xedit (IBM).