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. | ``` **     DO THIS: Press PF3.     ```** The VAPSEE pop-up should disappear, returning to the VACSEE screen "as it was before you pressed PF10. If you altered (cont.) the city, state, zip code data in the pop-up, the altered values will not show on the VACSEE display until you press (cont.) ENTER to refresh the screen. # Appendix A -- How to Call a SubTask ## Linking to a Subroutine MMP Since your MAGEC MMP's are Cobol programs you are able to use the standard facility of your TP Monitor to invoke (cont.) another program as a subtask. This is known as "linking" to another program in some circles. You can code the "native" (cont.) command in your Customization coding as: | ``` ** EXEC CICS LINK . . . etc. CALL 'WSTCOBOL' USING SIGNOFF, SOLINK . . . etc. ```** and so forth, depending on your TP Monitor. However, *there is a better way*. Your MMP automatically includes a "service routine" which you can perform to (cont.) accomplish the same thing a lot easier. Using the built-in service routine also keeps your MMP's portable since MAGEC (cont.) will generate the appropriate code into it if you upgrade or transport to another TP Monitor. In order to take advantage of this routine your subprogram must be named according to the MAGEC standard (MMPnnn) on the Load Library (OS) or Core Image Library (DOS). You can use the routine to invoke a subprogram at any time in the MMP. The TWA data is passed to the subprogram and (cont.) back to the calling MMP. The two programs can communicate with each other using the TWA. The TWA is not saved, (cont.) initialized, or restored by MAGEC when you invoke subprograms this way. If your MMP moves a value into a field in the (cont.) TWA before invoking the subprogram, then the subprogram will "see" the value in that field. If the subprogram alters (cont.) that value before it returns back to your MMP, then your MMP will "see" the altered value. To invoke a subprogram, code: MOVE 'nnn' TO TWA-NONTP-MMP. **PERFORM AA850-SUB-CALL THRU AA899-EXIT.   where: 'nnn'               = the MMP number of the subprogram. Control will return to the next sequential instruction after the PERFORM. # Appendix B -- How to Fetch Another Function ## Chaining Screens Often in your development you will find a need to establish a sequence of screens in your applications. For instance, (cont.) you might decide that whenever an operator completes the screen function to add a new customer to the Customer file (cont.) (ie. CUSADD function) the next thing that he/she will probably want to do will be to add an invoice for that customer (cont.) (ie. IVCADD function). You would probably want the IVCADD screen to "pop up" automatically, ready for data to be keyed (cont.) into it. Another example might be a case where you want to give the operator the capability to hit a PF key (or to type (cont.) something onto the screen) to indicate that he/she wishes to transfer immediately to some predetermined screen (cont.) function. A menu-type screen would be an example of this. MAGEC has a built-in facility to accommodate "fetching" to another screen function. To do so, just code: MOVE FTH-FUNCT TO TWA-NONTP-REQUEST. MOVE 'xxxxxx' TO SFUNCT. GO TO AA900-GOBACK.   where: 'xxxxxx'               = the six-character Function Code you wish to transfer to. The entire TWA and all Mask data is passed to the "fetched" MMP intact. You can also move a value into the Screen Key (cont.) field (SKEY) to be passed to the fetched MMP. It is also permissable for the Function Code specified to be one of the (cont.) functions handled by this same MMP; for instance VACLOC could legally fetch to VACSEE. Indeed, when you use the (cont.) cursor-selection feature of VACLOC that is exactly what happens. There is also a way you can fetch by specifying the MMP number instead of a Function Code. This feature exists solely (cont.) to facilitate conversions from non-MAGEC applications to MAGEC. We recommend that you use the FTH-FUNCT method whenever (cont.) possible. To fetch a specific MMP you would code: MOVE FTH-CMD TO TWA-NONTP-REQUEST. MOVE 'mmm' TO TWA-NONTP-MMP. GO TO AA900-GOBACK.   where 'mmm' is the MMP number of the program to be fetched. It must be named according to the MAGEC standards for Load Library (OS) or Core Image Library (DOS) members. You must not GO TO AA900-GOBACK from within a PERFORM'ed routine. NOTE: ** (This note applies to BOTH of the above types of fetches.) When the fetched program completes its processing it does not return back to the MMP which fetched it. The fetched MMP (cont.) has logically "overlaid" your MMP and when it completes it will return to the MAGEC Control Program (just as your MMP's (cont.) do). The fetched program may fetch another MMP, which may also fetch another MMP, and so on. Excessive use of this (cont.) facility could have an adverse effect upon online performance. # Appendix C -- Reading a Mask ## How to Initialize TWA-MSK-AREA The standard logic generated for your MMP includes all the correct coding to initialize the TWA-MSK-AREA with either (cont.) the common browse Mask (Mask 652) or the Mask you generated (Mask 600) at the proper times. You will most likely never (cont.) need to add Custom coding to initialize the Mask area; however, there is a facility for you to do so, in case you ever (cont.) require it. You might someday want to develop an MMP which uses more than just the two Masks which are automatically handled in the (cont.) standard logic. In that case you would have to initialize the area with your other Masks at the proper times. There is (cont.) no limit as to how many Masks an MMP may use. To initialize the TWA-MSK-AREA code: MOVE MSK-CMD TO TWA-TP-REQUEST. **MOVE 'NNN' TO TWA-TP-TRM. PERFORM AA800-CALL-MONITOR THRU AA899-EXIT. IF (GET-MSK-ERR) PERFORM BB800-MSK-ERR-MSG THRU BB899-EXIT GO TO AA800-SEND-SCREEN.   The initialization of the Mask area actually involves a read of the Mask's initialization record from the MAGEC MSK (cont.) file. It is done by the I/O module (MAGECIO). The error status (GET-MSK-ERR) is set by MAGECIO if an error of any sort (cont.) was encountered in trying to read the record. The BB800 routine contains the RECOMMENDED action to be taken when such (cont.) an error occurs, you may want to deviate from that -- just BE CAREFUL! ## Mask Copybook When a Mask is to be read into your appplication you will almost certainly wish to include the copybook which describes (cont.) that mask. A standard online MMP already used three Masks by default. They are the maintenance screen mask, the common (cont.) browse mask, and the pop-up window mask for the Short-List feature. The copybooks for these are automatically included (cont.) into the MMP. If you need to include a copybook for another Mask, it should be inserted into the %USRAREA insertion point. Remember, (cont.) these Mask copybooks all redefine the same area, TWA-MSK-DETAIL, and therefore you must be careful not to reference (cont.) datanames for fields within one Mask while a different Mask is "active". This is true even with the standard default (cont.) MMP's which use only the basic three Masks. Since the references to these standard Masks are largely generated by (cont.) Next: https://magec.com/DOC/markdown/cstm11.md.txt