When you are adding customization to an insertion point for which there is default logic, you will usually be presented (cont.) with a proforma (on the screen) which resembles the default logic. It is usually easiest to then just press ENTER, (cont.) adding the code from the screen to the dictionary as custom code, then to edit the new custom code. You can insert (cont.) additional coding plus retain the default coding in that manner. The solution is just below here. ## Solution to Test Project 4 To accomplish the objective of Test Project 4, from the prior page, you should have added the following statement into the %PFKEYM insertion point for application 600:  IF (TWA-MSK-PF6-HIT) **     MOVE QUOTE TO TWA-MSK-AID     MOVE FTH-FUNCT TO TWA-NONTP-REQUEST     MOVE 'SIFSEE' TO SFUNCT     GO TO AA900-GOBACK.   The sequence of the MOVE's is not important. The MOVE QUOTE TO TWA-MSK-AID is optional, but it is a good idea. You should have added this code by doing: ALGADD 600/PFKEYM ** proforma is displayed ** press ENTER to add code from screen as new custom code ** data is added, screen returns in "edit mode" ** position cursor above first line of code, press PF20 ** screen "opens up" for lines to be inserted ** type in the code shown above, press ENTER ** new lines inserted, screen displays them ** submit MMPCREAT (in batch) ** ** NEW COPY as appropriate to your environment ** ** NOTE: ** The proforma for the %PFKEYM insertion point includes the logic to test for all the standard MAGEC/SAA PF keys. It also (cont.) includes the logic to test for the situation in which an operator is doing an inquiry function and attempts to modify (cont.) the displayed data. The default logic issues a message asking: Did you Intend to Change Data? The operator may then (cont.) alter the Function Code to xxxCHG and press ENTER to complete the update. A popular alternative is to have the program (cont.) bypass the question and automatically alter the function code to xxxCHG and to process the update immediately. Neither (cont.) method bypasses any security since MAGEC will verify that this operator is allowed to do the CHG function before (cont.) actually accepting it. The proforma for %PFKEYM shows the default logic commented out and the alternative logic added (cont.) below it. If you want to retain the default method of asking the operator ratner than automatically processing the (cont.) update, you must remove the asterisks from column 7 of the default code shown and remove the alternate logic below it. (cont.) Otherwise, the program will do the automatic switch to the xxCHG function. # Project 5 ## Using Lookup Tables ** NOTE: ** By this time we assume that you have learned something from the earlier tutorials. This project gives you less (cont.) "hand-holding" and leaves you to your own devices. It does give you liberal hints and suggestions to help you along, (cont.) though. MAGEC includes some very useful and powerful features associated with editing a screen field against a table of valid (cont.) values. One obvious example of how these features can be used is in the validation of a State (or Province) code as (cont.) part of an address. | ``` **     DO THIS: This project will also require you to think about what you have learned so far. Please read the instructions below .     ```** The Vacation file (Data Class VAC) actually contains more data than we have been using thus far in our tutorial (cont.) projects. There is an Element named VAC02 which contains the City, State, and Zip (as in a U.S. street address) for (cont.) each employee on the file. It is possible that for some of the employees there is not actually valid data in these (cont.) fields, but merely the default value of spaces. That will become apparent to you when you try to access that (cont.) data. The very first screen you filled in when you initially began to develop the Vacation application was the Screen Header (cont.) Definition. Refer to Figure 01 in the "Application Developer" tutorial. That screen (the SHDxxx screen) includes a (cont.) parameter for the Verify Option. We initially set that option to NO. The verify option tells MAGEC whether to generate (cont.) special code into your MMP which will protect against bad data which is read from your files and databases. As you (cont.) know, Cobol programs ordinarily will abend if they try to access non-numeric data in a numeric field. Since we are now (cont.) going to access Element VAC02, which we have said may contain non-numeric Zip codes (spaces), we should turn on the (cont.) verify option in order to protect ourselves. We must also add Element VAC02 to the list of Elements to be accessed from the VAC Data Class. | ``` **     DO THIS: Use the SHDCHG function to alter the Verify Option from NO to VERIFY, and to add VAC02 as Element 2 under the Element Names parameters.     ```** Be sure you receive the message in SCOMPL, top right of the screen, which says: Data UPDATED on Database, otherwise, you probably entered something incorrectly. | ``` **     DO THIS: Look at the screen shown in Figure 39. Our objective is to modify the Vacation screen to look approximately like this.     ```** The new fields are highlighted by the shadow box. There are seven new fields. Three of them are Prompts (constants). (cont.) Three of them are variables. and one of them is a "W-field" used to display the state name associated with the (cont.) two-character state abbreviation code. | ``` ** VACSEE 01 Date: 08/15/1993 VACATION/SICK/COMP DAYS Time: 01:15:03 Emp# 000-00-0001 First Name Harry Last Name Houdini Hire Date 12/31/87 Earned Vacation 14.50 Vacation Taken 2.25 Due 12.25 Sick Days Earned 124.50 Sick Days Taken 3.00 Due 121.50 Comp Days Earned 2.00 Comp Days Taken .00 Due 2.00 Comments (3 lines) Heavily into Escape literature. Likes to be submerged while handcuffed and strait-jacketed in a coffin-like vault Total Days Due 135.75 City Waxahachie State TX Zip 75102 Texas Press PF4 for browse (LOC) screen Press PF13 for Hardcopy Press PF16 to Copy field to buffer Press PF17 to Paste data from buffer Press PF2 for field-level HELP ```** Figure 39 -- Address Data on Inquiry Screen ## Manual Screen Painting For this project we will have you use the manual screen painting facility, MSKDEF, which you have used before (refer to (cont.) Figure 12 in this "Customization" tutorial) to add the new fields to the screen. That will help familiarize you with (cont.) more of the specification parameters for screen fields. You can draw the "constants by typing the literal values, i.e. "City", directly onto the screen exactly where you want (cont.) them. Don't forget to use the less than symbol () to define the size of each field. You can draw the "variables using either all X's or all 9's to indicate alpha-numeric or numeric fields. Only the Zip (cont.) Code field is numeric, the others are alpha-numeric. The city name is 15 characters long, the state code is 2 (cont.) characters long, and the zip code is 5 digits long. The "W-field" in which the state name is to be displayed should be (cont.) approximately 20 characters long. Its size is not very critical since MAGEC will automatically truncate or pad the (cont.) state name to make it fit into whatever size field you give it. | ``` **     DO THIS: Use the MSKDEF function to draw the seven new screen fields onto Mask 600.     ```** Once you have drawn the new fields onto the screen you must modify the specifications for all but the three constant (cont.) fields. To do this you use the PF18 key, as before. Each of the specification parameters will be shown with its default (cont.) value, you overtype the default to alter it to the value you desire. The desired values are:           Scrn Fld (cont.) NM      Source/Target        L (cont.) gth         Type -- R/O (cont.)           TBL# city            SCITY   & (cont.) nbsp;      VAC02-CITY        & (cont.) nbsp;15            X   &n (cont.) bsp;  "Required state          SSTATE      (cont.) ;  VAC02-STATE      02      &n (cont.) bsp;     T      "Required       (cont.) 003 zip code      SZIP        &nbs (cont.) p;   VAC02-ZIP           05&nb (cont.) sp;           N      (cont.)  "Required W-field        SSTNAM      &nb (cont.) sp;                & (cont.) nbsp;         20      &nb (cont.) sp;     W      "Optional In addition, you must specify the W-Fld parameter for SSTATE as being "SSTNAM". This tells MAGEC that SSTNAM is the (cont.) W-field for SSTATE. MAGEC will automatically place the description (in this case, the state name) into the W-field (cont.) based upon the code (in this case, state abbreviation) entered into the T-field (in this case, (cont.) SSTATE). Also, you must specify the number of significant digits (SIG) left of the decimal point, and the number of decimal (cont.) places (DEC), for any numeric fields. For the SZIP field there are 5 digits left, and no digits right of the decimal (cont.) point. We have arbitrarily specified that each of the variables will be a Required field. That means that MAGEC will issue an (cont.) error message to the operator if it is left blank when doing add or change operations. If a field is optional, MAGEC (cont.) will appropriately default it to either spaces or zeros on the database if it is left blank. You should us an unprotect field attribute for the city name, state code, and zip code variables; use skip-protect attributes for the other four fields. | ``` **     DO THIS: Do the MSKCRE function by pressing PF10 from the MSKDEF screen, then re-submit MMPCREAT to re-generate and compile the application.     ```** ## Demonstrate Table Features Once you have achieved a clean compile, which should be in the first try unless you made an error somewhere along the (cont.) line, you are ready to test. In the PC environment it is not necessary to issue any NEW COPY command, but on a (cont.) mainframe, it is. For more detail reagrding this, refer to the discussion in the "Application Developer" tutorial (cont.) regarding "New Copy of MMP" which is near Figure 15 in that section. | ``` **     DO THIS: Do a NEW COPY, as appropriate     ```** You should now be able to use the VACCHG function to try to update an employee's vacation data. The new city, state, (cont.) and zip fields should be on the screen. If the data is missing (i.e. blanks) you should receive error messages, such (cont.) as: Required Data Not Entered     Warning! Bad Data on File   Next: https://magec.com/DOC/markdown/cstm09.md.txt