You can type into the city, state, and zip fields to update the data on file, thereby correcting the errors noted. If you enter a valid state or province abbreviation (that is, one which is defined in Table #003), the appropriate (cont.) state name will appear on the screen in the W-field. If you enter an invalid abbreviation, you will receive an error (cont.) message, as: Invalid State/Province Code     If you point the cursor into the State Code field (SSTATE) and press PF2, the low-level Help key, you will receive (cont.) field-level help for that screen field. This is much like the field-level help for any other screen field, except that (cont.) there will be a message telling you that you can press PF8 to list the table of valid values (table #003, the State / (cont.) Province Code Table). If you press PF8 you will receive the first page of valid state codes, subsequently pressing PF8 (cont.) will page forward, PF7 pages backward. When you have a list of state codes displayed on the screen, you can position the cursor down to the line on which the (cont.) desired code appears (i.e. Texas) and press ENTER. MAGEC will then copy the code from the table into the screen field (cont.) from which you pressed PF2. The screen will return to the Vacation screen, but the selected code will be filled into it (cont.) automatically (i.e =. TX will be in the State Code field). This eliminates the need for your operators to memorize (cont.) lists of codes. When the code is copied from the table into your screen field, as described above, you will see a message displayed in (cont.) SCOMPL saying that a code was copied from the table onto your screen. This does not update the file, it merely places (cont.) the code into the screen field. You can modify it, or any other screen field's data, then press ENTER to update the (cont.) record on the database. ## Table Maintenance Table #003 is provided with MAGEC when the system is initially installed. Table #003 is used for the tutorial projects (cont.) and as a demonstration of how Lookup Tables work. It can also be used by any of your own applications to validate state (cont.) or province codes. Any MAGEC Lookup Table can be used by any number of applications. You can modify any Lookup Table using the built-in online functions provided with MAGEC. Tables are identified by a 3-digit number, 001 through 999. The numbers 200 through 255 are reserved for use by the MAGEC software. To display any given MAGEC table you can use the online command: TBLLST nnn     where nnn is the 3-digit table number. To alter any entry in a table you can use the command: TBLCHG nnn/eeeeeee     where "nnn" is the 3-digit table number and "eeeeee" is the code (up to 16 characters long). Similarly, you can add an entry to a table using the command: TBLADD nnn/eeeeee     or you can delete any entry using: TBLDEL nnn/eeeeee     If you prefer a batch hardcopy listing of any given table, or of several tables, you can use the batch utility program, (cont.) TBLLIST. Refer to the "Offline Utilities" chapter of your *Programmer's Reference Guide* for details regarding (cont.) TBLLIST. Now, let's look at the display of the State / Province Table. | ``` **     DO THIS: Enter the command: TBLLST 003, press ENTER.     ```** For details regarding how to define your own tables, refer to the "Database Administration" chapter of your *Programmer's Reference Guide*. For details on how to produce a Where-Used report for any table, refer to the "Offline Utilities" section of your *Programmer's Reference* manual under the topic "MAGECLBR". # Project 6 ## Generating Pop-Up Window Programs ** NOTE: ** In this project we will demonstrate another way that you could have added the capability for the operator to update and (cont.) see the city, state, and zip code information. Rather then placing it on the VACxxx screen (MSK600), as we just did in (cont.) Project 5, we could generate another program which uses a miniature screen, approximately one-fourth the size of the (cont.) large full-screen display. We could have shown the city, state, and zip code data in that smaller screen and we could (cont.) have "CALL"ed the small screen program from MMP600, effectively popping up a window. When the operator is finished (cont.) looking at or updating the data in the small window, he/she can return to the full-screen as it was left by merely (cont.) pressing PF3. A pop-up window program is very much like any other program except that it uses a smaller screen area and it does not (cont.) erase the data previously on the screen when it is invoked. The small window is superimposed on the larger screen (cont.) "behind" it. pop-up window programs can do the same kinds of functions as can full-screen programs. The standard set of (cont.) nine functions is available to select from, plus any custom functions can be added. A pop-up window program and screen are not limited to being invoked by just one particular calling program, but rather, (cont.) they can be invoked from any number of other programs. The most usual way to invoke a pop-up window program is via the (cont.) MAGEC Attach / Detach facility discussed in Appendix R of this section; however, you can invoke a pop-up window program (cont.) via the Fetch (discussed in Appendix B), or just by typing one of its Function Codes into SFUNCT on the screen, since (cont.) they are really just ordinary programs like any other. Similarly, the Attach / Detach facility is most often used to (cont.) 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: Next: https://magec.com/DOC/markdown/cstm10.md.txt