GDDM V3R2 Base Application Programming Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF | BOOK


Example: Program using two operator windows

GDDM V3R2 Base Application Programming Guide
SC33-0867-01



The following program extends OPWIN1 to create and display two operator windows, each with its own virtual device. A picture can be displayed in each window, so that they can be visually compared.

Whenever the function in the active operator window is waiting for input, the terminal user can select another operator window to have top priority in the viewing order, and therefore to be active. This can be done with the implicit user control function by either moving the graphics cursor (if displayed) into the required window, and selecting it using any of the following:

  • ENTER key
  • Button 1 on a mouse or puck
  • Stylus tip.
    
    
or, if the graphics cursor is not displayed, the window can be selected by moving the alphanumeric cursor into the required window and pressing the ENTER key. The terminal user can, instead, press the PF1 key to explicitly enter user control mode. Using this function, the size, position, and viewing priority of operator windows can subsequently be changed. All of the above manipulations of the operator window by the user can be carried out without interaction with the application program.



OPWIN2: PROC OPTIONS(MAIN); DCL (TYPE,MOD,COUNT) FIXED BIN(31); DCL (VALID,FINISH) BIT(1) INIT('0'B); DCL PROCOPTS(7) FIXED BIN(31) INIT(24,1,28,1,29,1,1); DCL NAMES(1) CHAR(8), /* DSOPEN dummy namelist */ ( START INIT(0), /* Parameter to SHOWGDF */ READ INIT(1), /* Parameter to SHOWGDF */ WINDOW, /* Window to run next */ WSARR(10) INIT((10)0) /* WSCRT parameter array */ ) FIXED BINARY(31);

/****************************************************************/ /* Open real device for windowing */ /****************************************************************/ CALL FSINIT; CALL DSOPEN(9,1,'*',7,PROCOPTS,0,NAMES);/* Open real device */ A CALL DSUSE(1,9); /* Use real device */

/****************************************************************/ /* Create two operator windows */ /****************************************************************/ WSARR(3) = 32; /* 32 row virtual screen */ WSARR(4) = 80; /* 80 column virtual screen */ WSARR(5) = 2; /* Top-left corner row window on glass */ WSARR(6) = 3; /* Top-left corner column window on glass */ WSARR(7) = 20; /* # Rows of window on glass */ WSARR(8) = 60; /* # cols of window on glass */ WSARR(9) = 13;/* Top-left corner row window on virtual screen */ WSARR(10) = 1;/* Top-left corner col window on virtual screen */ CALL WSCRT(2,10,WSARR,35,'GDDM Programming Example - Window 2'); B /* Create window 2 */

WSARR(3) = 32; /* 32 row virtual screen */ WSARR(4) = 80; /* 80 column virtual screen */ WSARR(5) = 10; /* Top-left corner row window on glass */ WSARR(6) = 20; /* Top-left corner col window on glass */ WSARR(7) = 20; /* Rows of window on glass */ WSARR(8) = 59; /* Cols of window on glass */ WSARR(9) = 13; /* Top-left corner row window on virtual screen */ WSARR(10) = 1; /* Top-left corner col window on virtual screen */ CALL WSCRT(1,10,WSARR,35,'GDDM Programming Example - Window 1'); C /* Create window 1 */

WINDOW=1; CALL SHOWGDF(START); /* Initialize window 1 */ D CALL DSUSE(1,9); /* Reuse real device */ CALL WSSEL(2); /* Select operator window 2 */ E WINDOW=2; CALL SHOWGDF(START); /* Initialize window 2 */ F

/****************************************************************/ /* Perform real i/o and select transaction processor */ /****************************************************************/ DO UNTIL (FINISH = '1'B); DO UNTIL (VALID = '1'B); CALL DSUSE(1,9); /* Reuse real device */ G CALL WSIO(WINDOW); /* Real I/O */ H CALL SHOWGDF(READ); /* Process transaction */ I END; VALID = '0'B; END; CALL DSUSE(1,9); /* Reuse real device */ G CALL WSDEL(1); /* Delete window 1, close its virtual device */ CALL WSDEL(2); /* Delete window 2, close its virtual device */ CALL FSTERM; RETURN; /****************************************************************/ /* Transaction processing routine */ /****************************************************************/ SHOWGDF: PROC(action); DCL (ACTION,SEG_COUNT,OPT_ARRAY(2) INIT(0,2)) FIXED BINARY(31), NAME CHAR(8), DESCRIPTION CHAR(1); SELECT(ACTION); WHEN(START) /* Initialization of screen */ DO; CALL DSOPEN(WINDOW,1,'*',0,PROCOPTS,0,NAMES); J /* Open a virtual device */ /* Device id = window id */ /* for simplicity */ CALL DSUSE(1,WINDOW); /* Use virtual device */ K CALL GSFLD(1,1,30,80); CALL ASDFLD(1,31,2,1,44,2); CALL ASFCOL(1,1); CALL ASCPUT(1,44,'Enter the name of a picture to be displayed:'); CALL ASDFLD(2,31,47,1,8,1); CALL ASFCOL(2,4); CALL ASDFLD(3,32,2,1,35,2); CALL ASFCOL(3,1); CALL ASCPUT(3,35,'PF1=User Control 2=Show 3=End'); CALL ASFCUR(2,1,1); END; /****************************************************************/ /* Input transaction - validate */ /****************************************************************/ WHEN(READ) DO; CALL DSUSE(1,WINDOW); /* Use virtual device */ L CALL ASREAD(TYPE,MOD,COUNT); M CALL ASFCUR(2,1,1); IF TYPE = 1 & ((MOD = 2) /* If (PF key 2 pressed */ & (COUNT > 0)) /* and a picture name entered)*/ | MOD = 3 THEN /* OR (PF key 3 pressed */ DO; /* then perform action */ VALID = '1'B; IF MOD = 2 THEN DO; CALL GSCLR; CALL ASCGET(2,8,name); CALL GSLOAD(NAME,2,OPT_ARRAY,SEG_COUNT,0,DESCRIPTION); END; IF MOD = 3 THEN FINISH = '1'B; END; ELSE /* else ... */ CALL FSALRM; /* sound alarm */ END; OTHERWISE; END; RETURN; END SHOWGDF; %INCLUDE ADMUPINA; %INCLUDE ADMUPIND; %INCLUDE ADMUPINF; %INCLUDE ADMUPING; %INCLUDE ADMUPINW; END OPWIN2;


Figure 132. The "OPWIN2" program


The above program illustrates a "transaction processing" type of input design. This kind of design could form the basis of a window management program that did not use a coordination exit.

The program is essentially similar to OPWIN1. The DSOPEN call at A opens the real device for windowing. This time two operator windows are created, by the calls to WSCRT at B and C . When you first create a number of overlapping operator windows in an application, the viewing order depends on the order that you create the operator windows in. The operator window that you create first is at the bottom of the viewing order, and the operator window that you create last is at the top. On the display screen, each operator window appears in front of the operator windows that are below it in the viewing order. The topmost window (operator window 1 in the example) is the active operator window. Your program can change the viewing order, as described in "Prioritizing operator windows" in topic 22.2.4.

As mentioned in the previous section, the current operator window is the one whose attributes can be modified by a WSMOD call. The candidate operator window is the window with which the next virtual device to be opened is associated. In a single application like the example, not running under a task manager, the current operator window is always the candidate operator window. So, when is the current operator window not the candidate operator window? Remember, when you have several applications running concurrently under a task manager, only one of those applications is actually executing, while the others are waiting because they have unsatisfied reads outstanding. Each of the applications can have a current operator window. But no matter how many devices or applications there may be, only the operator window made current by the most recently executed WSCRT, WSSEL, or WSIO call is the candidate operator window with which the next virtual device to be opened is associated.

After the WSCRT call at C , operator window 1 is the current and candidate operator window. At D the program calls SHOWGDF(START) to open and use a virtual device for operator window 1 and to initialize the window with procedural alphanumerics. Following the call to SHOWGDF(START), the program issues a call to DSUSE to reuse the real device, because SHOWGDF(START) contains a DSUSE to a virtual device.

The WSSEL call at E selects operator window 2 to be the candidate operator window. WSSEL also makes the operator window current. Making an operator window current has no effect on the viewing order. At F the program calls SHOWGDF(START) to open a virtual device for the operator window 2 and to initialize the window with procedural alphanumerics.

To keep the program as simple as possible, it calls the routine SHOWGDF for both operator windows. You could easily alter the program to call a different routine for each window. The DSOPEN call at J opens a virtual device and gives it the same identifier as the operator window with which it is associated. This has been done because SHOWGDF is called for two windows, and therefore two separate virtual devices are opened. It also makes it clear which virtual device is associated with which operator window. In practice you could give the virtual device any valid identifier, if it differs from any other device identifier within the same instance of GDDM. GDDM automatically associates each virtual device with its respective operator window.

The "do loop" that follows performs the I/O for the real device and, for the active operator window, calls SHOWGDF(READ) to restore and display a picture. Where there are several operator windows in an application, as in the example, the operator window that is the highest in the viewing order immediately before the input/output call (WSIO in the example) is the active operator window. The first time through the do loop operator window 1 is the topmost operator window when I/O takes place for the real device, at H . It is therefore initially the active operator window.

The user can change the viewing order by selecting a different window to be active. You can also change the viewing order in your program, as described in "Prioritizing operator windows" in topic 22.2.4.

The call to DSUSE at G is necessary to reuse the real device as the primary device, because in SHOWGDF, which is called at D , F , and I , there is a DSUSE to a virtual device.

The WSIO call at H displays the two windows and their contents on the screen of the real device. In WSIO's one parameter, GDDM returns the identifier of the active operator window. WSIO also makes the active operator window the current operator window. If the terminal user should alter the viewing priority of the two windows and make a different window active, using control mode for example, GDDM returns the identifier of the new active operator window in WSIO's parameter.

When WSIO is called for a device that has windows that do not specify coordination exits, as in the above example, GDDM behaves as follows: When the terminal user interacts with the active window, WSIO completes, and creates a pending attention interrupt for the virtual device associated with the window. (If an attention interrupt is already pending for the virtual device, it is replaced by the new one.) The interrupt is left pending until the next I/O function is called for the virtual device. If the next I/O function is an ASREAD, as in the example, then, as it normally waits for an attention interrupt, it is satisfied by the one that is pending. Therefore, no I/O is performed by the ASREAD, but the pending information is returned. For a description of how WSIO behaves with coordination exits, see "Task management" in topic 22.2.7.

In SHOWGDF, called at I , the DSUSE call at L uses the operator window identifier returned by WSIO to ensure that the virtual device used is the one associated with that operator window. The ASREAD that follows, at M is therefore always issued against the virtual device associated with the active operator window.

The first two windowing programs have introduced the basic principles of operator windows, and some of the calls. The following sections describe some of the other windowing calls.

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012