invoke pop-up window programs, but it can also invoke full-screen programs just as well.
Since you have just finished doing a project which placed the city, state, and zip code onto the full-screen display, (cont.)
creating a pop-up window to display them will seem unnecessary and redundant. It is! Remember, we are doing this (cont.)
project just to demonstrate how to create a pop-up window application.
Developing a Pop-Up window application is really almost exactly like developing any other application. The process is (cont.)
very similar to the one you used in the very first project in the "Application Developer" tutorial. The differences (cont.)
are:
1. You will specify "MODELWIN" as the model to use when generating the application, rather than the default "MODELMMP".
2. You will be forced to use the manual screen painting method since automatic screen painting is not yet supported (as of release 2.6) for developing pop-up windows applications in MAGEC.
3. MAGEC will automatically prepare the screen painter with a border to mark off the pop-up window. You should draw your screen fields within that border.
Other than that, there is really no difference from what you did in the first development tutorial project.
To invoke the pop-up window program from MMP600, you will use the Attach facility. This is very similar to what you did (cont.)
in Project 4, earlier in this section, except that in that project you used the Fetch facilty. The Fetch does not (cont.)
automatically set up for a return to the calling program and screen as the Attach does. In Cobol lingo, the Fetch and (cont.)
Attach are to one another as are the GO TO and PERFORM .
Since we will be developing an entirely new program, we must first choose an MMP number and Mask number for it. For (cont.)
this project we will choose MMP800 and Mask 800. We can use the TSKLST to help us through the process as we did (cont.)
before.
| ```
**     DO THIS:
Type the command TSKLST 800, and press ENTER.
   
```**
The SHDADD screen should appear with 800 set into the key area of the screen (SKEY).
| ```
**     DO THIS:
Fill in the screen, specifying the following: (then press ENTER)
MMP# 800
Function Code Prefix VAP
Verify Opt VERIFY
Use MODEL MODELWIN
Primary DCL VAC
ELTs VAC01 VAC02
   
```**
**
NOTE:
**
In this application we really want only the city, state, and zip code data (all of which are contained in element (cont.)
VAC02) to be displayed on the screen; however, we are selecting Element VAC01 as well as VAC02 because the key for the (cont.)
record is in Element VAC01. It is *always advisable* to read the record key with the data, even in cases where you (cont.)
theoretically do not need the key.
The prefix VAP stands for Vacation Popup (an arbitrary choice). Since the function codes VACxxx have already been used, we must specify some other unique function codes for this program.
The MMPADD screen will appear with 800 filled into the key area (SKEY), and default values filled into the fields in (cont.)
the body of the screen. These default values were copied from the prior screen (SHDADD) and will be correct almost all (cont.)
of the time. There will also be a white box displayed with a message telling you that you can press PF6 to review, or (cont.)
modify, the selection of functions to be included into this program.
| ```
**     DO THIS:
Press PF6.
   
```**
A pop-up window appears with all nine of the standard functions highlighted (selected) as a default. You can place the (cont.)
cursor to the line on which any of the functions is shown and press PF4 to unselect, or ENTER to select it. We wish (cont.)
only to be able to see and change data in this program.
| ```
**     DO THIS:
Unselect all functions except for SEE/NXT and CHG. Then press PF6
to apply your changes and proceed.
   
```**
The TSKLST display will appear showing your current status for developing MMP800.
| ```
**     DO THIS:
Cursor-Select the "Paint Screen" task, press ENTER.
   
```**
The MSKDEF screen (manual screen painter) appears immediately. It has a square border drawn on the screen showing the (cont.)
dimensions of a one-fourth-size pop-up screen. The reason that MAGEC is able to know that this is a Pop Up screen, (cont.)
rather than a full screen, is because you specified MODELWIN in the SHD (Screen Header) definition.
**
NOTE:
**
It is possible, and legal, for you to draw fields outside of that border, or to alter the size and shape of the pop-up (cont.)
screen; however, at this stage of your training it is wisest to just "color within the lines" until you have more (cont.)
experience and can deal with added complexity.
Since you specified to access both Element VAC01 and VAC02 earlier, you have all of the fields within both those (cont.)
Elements available to this application. All that is necessary to meet our objective is to place the city, state, and (cont.)
zip code in this screen; however, you may wish to also display the Employee number so that an operator looking at this (cont.)
display clearly knows to which Employee this address data belongs.
| ```
**     DO THIS:
Draw the fields on this screen to display city, state, and zip code, with the appropriate
prompts and with the W-field for displaying state name.
   
```**
The fields will be exactly like those you drew in the previous project (Project 5), but they will be in different (cont.)
locations on the screen. Refer to the previous project if you do not remember what to do.
**
HINT:
**
If you have spent a little time studying the *Programmer's Reference* manual, "Screen Painting" section, you might have (cont.)
noticed that you can duplicate a field from one Mask to another. You could, for example, use the Field Dup function (cont.)
(PF20) to duplicate a field from Mask 600 to Mask 800. You can specify the target Mask#, Row and Column when you use (cont.)
the Field Dup key. Doing that would reduce the amount of work you have to do here since you have already drawn fields (cont.)
onto Mask 600 exactly like you need them on Mask 800.
One way to ascertain the desired Row and Column is to just move the cursor to where you would like a field and look at (cont.)
the bottom-right-hand corner of your screen. In most environments MAGEC, or the terminal controller, will display the (cont.)
Row and Column of the cursor's position there.
| ```
**     DO THIS:
Press PF10 to execute MSKCRE.
   
```**
MSKCRE will generate the screen Mask and the Cobol copybook for it.Next, MSKSEE will display the new screen to you.
At this point you have finished generating the screen Mask and it is time to generate the MMP (program).
| ```
**     DO THIS:
Press PF15 to exit MAGEC.
   
```**
| ```
**     DO THIS:
Submit the MMPCREAT batch jobstream for 800.
   
```**
If you have a clean compile, you are ready to test the new program. If not, correct your errors and re-submit MMPCREAT, then begin testing.
| ```
**     DO THIS:
Log back onto MAGEC using the TS01 transid, Employee# 18, password=ALEE.
   
```**
Since the new program is not yet being invoked by any other program, the only way for you to test it now is to type in the Function Code with an appropriate key value.
| ```
**     DO THIS:
Type in the command: VAPSEE 01, and press ENTER
   
```**
Your little pop-up screen should appear with the data for Employee 01 showing. If you wish, you can update the data by changing it on the screen and doing the VAPCHG function.
If all this seems to work, the next task will be to add the code into MMP600 to Attach to the VAPSEE function upon sensing some PF key. For this project we will use PF10 to invoke the VAPSEE pop-up.
Since the keys for the VACxxx and VAPxxx functions are identical (Employee#), it is not necessary to alter the contents (cont.)
of SKEY at all in order to invoke the VAPxxx functions from the VACxxx functions; therefore, we only need to alter the (cont.)
contents of SFUNCTand then to go do the Attach.
The insertion point at which this should be done is, you guessed it, %PFKEYM.
| ```
**     DO THIS:
Type the command: ALGSEE 600/PFKEYM, and press ENTER.
   
```**
The screen will display the PFKEYM custom coding as we last left it in Project 4 earlier. The code to sense PF6 and (cont.)
Fetch to SIFSEE is still there where we put it. Now we will add a test for another PF key (PF10) and an Attach to (cont.)
VAPSEE if PF10 was hit.
| ```
**     DO THIS:
Place the cursor onto the ruler line, above the first line of Cobol code, and press PF20 to insert more code.
   
```**
The screen "opens up" allowing you to type in more code to be inserted before the first line of Cobol code which was shown on the screen.
| ```
**     DO THIS:
TYPE in the following Cobol code:
   
```**
| ```
**
IF (TWA-MSK-PF10-HIT)
```**
| ```
**
      MOVE 'VAPSEE' TO SFUNCT
```**
| ```
**
      GO TO AA760-ATTACH.
```**
| ```
**     DO THIS:
Press ENTER.
   
```**
The screen will return to you with your new lines of code inserted at the top.
| ```
**     DO THIS:
Press PF15 to exit MAGEC.
   
```**
Next you must re-compile MMP600 to include the new custom coding.
| ```
**     DO THIS:
Submit MMPCREAT for 600.
   
```**
| ```
**     DO THIS:
Log back into MAGEC, as before.
   
```**
Now we will test the Attach from the VACSEE screen to the VAPSEE pop-up, and then the Detach back to the VACSEE screen.
| ```
**     DO THIS:
Type in the command: VACSEE 01, and press ENTER.
   
```**
The familiar VACSEE screen should be displayed.
| ```
**     DO THIS:
Press PF10.
   
```**
The VAPSEE pop-up should appear supreimposed on the VACSEE screen. You may change the data and do the VAPCHG function here, if you wish.

next: cstm14.md.txt