Modifier and Page numbers as comments and does not look at them. Therefore, if you have several "pieces" of Custom (cont.) coding on the Library, such as: 600/EDIT/AMOUNTS/001     600/EDIT/AMOUNTS/002     600/EDIT/STATUS     MMPCREAT will insert all three of these records' code into the Insertion Point %EDIT for Mask 600. They will be (cont.) inserted in the order they are read from the Library (the order shown above). In columns 73 - 80 in the Cobol listing (cont.) you would see literals displayed telling you exactly which Customization Algorithm you are looking (cont.) at. You can have up to 1000 "pages" (records) for a given unique Insertion Point/Modifier name. Each page can contain up to 15 lines. The Modifier names can be useful to you online when you are coding or maintaining your Customization. Instead of having (cont.) one very large "lump" of code for, say %EDIT, you might prefer to have several smaller pieces which you can manipulate (cont.) individually and which you can access directly by name. The choice is yours. Note:** Mask numbers must be three (3) characters, with the first character a numeric digit and the other two characters either alphabetic or numeric (i.e. 9XX). # Sample Project 3 ## Adding a Custom Function For the third project, we will add a new function, a tenth function which this MMP will support in addition to the nine (cont.) standard ones. The new function will be a variation of the Browse. It will sequentially read through all the VAC (cont.) records tallying the total number of days due for Vacation, Sick, and Comp days for all employees. This new function will not display the detail like the ordinary browse (VACLOC) does. It will only display the (cont.) total-for-all-employees figures. We can expect that this function will execute a bit slower than the others since it (cont.) must always start at the first employee and read all the way to the last before it can present a (cont.) screen. The MAGEC Security System controls access to each Function Code, not just to a Program. Even though our Vacation MMP (cont.) (MMP600) is now going to be processing ten different functions you can still have entirely separate and different (cont.) security parameters for each function if need be. Just because a particular operator might be allowed to do the VACLOC (cont.) or VACSEE function does not mean that you must allow him/her to do the new function. We will name the new function "VACTOT". We will not require the operator to enter any key value (Employee#) into SKEY (cont.) after the Function Code since we know that we must always begin at the very first Employee#. We will force *a key value (cont.) of "000000000" in the MMP. In this project we will be doing Cobol Customization coding into some new Insertion Points. You may wish to have the (cont.) chapters, MAGEC "Analysis of the Generated MMP" and MAGEC "Insertion Points" handy. They list all the Insertion Points (cont.) by their actual names (%EDIT, etc.) and direct you to the place in the generated MMP where each exists. You may also (cont.) refer to "Appendix H in this chapter, which lists all the Insertion Points and briefly describes their (cont.) use. ## New Function Code If you examine the Cobol listing for MMP600 you will notice that there is an Insertion Point named **%FUNCT**. You will (cont.) also notice that there is Default coding inserted there. The Default coding lists all the existing nine Function Codes (cont.) as valid values in "88-levels". The first thing you must do is to add your new VACTOT Function Code to this list. In the Proforma which you will see for %FUNCT you will notice the symbolic parameter (&PFX) throughout. When MMPCREAT (cont.) generates your MMP it will replace the characters (&PFX) with the Function Code Prefix. The Function Code Prefix was (cont.) specified on the Screen Header definition panel, it defaults to the name of your Primary Data Class (VAC). Thus, the (cont.) functions for this application are generated as: VACADD, VACCHG, etc. You will need to make entries in two places on the %FUNCT Proforma since every Function Code is defined once in the list of valid functions and once below to indicate what kind of function it is. **Do this:** Enter the command: ALGADD 600/FUNCT . . . and press ENTER. The ALGADD screen will appear with the Proforma for the Insertion Point, %FUNCT. **Do this:** Press ENTER again. You have added Custom code to the Library, it looks exactly like the Proforma so far. Next you will modify it. ``` ALGADD 600/FUNCT ** SEARCH ARG: .................................................................. Password: M A G E C FUNCT page New Password: CUSTOM ALGORITHM DEFINITION FOR MSK 600 ADD/MODIFY FUNCTION CODES TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40...;+...50....+...60....+...70.. 88 MAINT-FUNCTION VALUE '&PFXADD' '&PFXCHG' '&PFXDEL' 01 '&PFXSEE' '&PFXNXT' '&PFXDUP'. 02 88 BROWS-FUNCTION VALUE '&PFXLOC' '&PFXSCN' '&PFXFND'. 03 05 FILLER REDEFINES TEST-FUNCT. 04 07 TEST-FUNCT-KEY PIC XXX. 05 07 T-FUNCT PIC XXX. 06 88 SEE-FUNCTION VALUE 'SEE' 'NXT'. 07 88 NXT-FUNCTION VALUE 'NXT'. 08 88 ADD-FUNCTION VALUE 'ADD'. 09 88 CHG-FUNCTION VALUE 'CHG'. 10 88 DEL-FUNCTION VALUE 'DEL'. 11 88 DUP-FUNCTION VALUE 'DUP'. 12 88 LOC-FUNCTION VALUE 'LOC'. 13 88 SCN-FUNCTION VALUE 'SCN'. 14 88 FND-FUNCTION VALUE 'FND'. 15 Move CURSOR to a line, use ERASE EOF to Delete it -or- PF20 to Insert After it Semicolon (;) is the TAB Character Asterisk (*) in col. 1 = suppress upcase Press PF24 for Instructions Press PF4 for Menu of Named Proformas ``` Figure 29 — Proforma for %FUNCT ## Inserting New Function The ALGSEE screen now shows the Custom code on file for %FUNCT. You must alter it to correctly define the nine existing Function Codes *plus* your new VACTOT function. You must: 1. Add a new entry for BROWS-FUNCTIONS (it will look like: &PFXTOT). 2. Add TOT as a valid suffix which is equal to the LOC function (standard browse). 3. Remember to remove the period from the end of line 03 and add a period after the new function you have added to the list. Task 2 can be done by just overkeying the coding on the screen. Task 1 requires you to use the PF20 key to insert a line, as follows: Place cursor on line you wish to insert after. Press PF20. Key in your new line. Press ENTER. Do this:** Modify code to look like the example on opposite page. **Note:** Inserting a line caused the code to "overflow" to a second page. You can press PF8 to page forward if you (cont.) would like to see it. When you are looking at any Custom Algorithm (as you are now) the PF8 key will page you forward (cont.) and the PF7 key will page you backwards through ALL the Custom code for that Mask. You can also do Searches for any (cont.) character string (specified on line 2 of screen) which will scan ALL the Custom code for that Mask. ``` ALGNXT 600/FUNCT//000 ** SEARCH ARG: .................................................................. Password: M A G E C FUNCT page New Password: CUSTOM ALGORITHM DEFINITION FOR MSK 600 (000) ADD/MODIFY FUNCTION CODES TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40...;+...50....+...60....+...70.. 88 MAINT-FUNCTION VALUE '&PFXADD' '&PFXCHG' '&PFXDEL' 01 '&PFXSEE' '&PFXNXT' '&PFXDUP'. 02 88 BROWS-FUNCTION VALUE '&PFXLOC' '&PFXSCN' '&PFXFND' 03 '&PFXTOT'. 04 05 FILLER REDEFINES TEST-FUNCT. 05 07 TEST-FUNCT-KEY PIC XXX. 06 07 T-FUNCT PIC XXX. 07 88 SEE-FUNCTION VALUE 'SEE' 'NXT'. 08 88 NXT-FUNCTION VALUE 'NXT'. 09 88 ADD-FUNCTION VALUE 'ADD'. 10 88 CHG-FUNCTION VALUE 'CHG'. 11 88 DEL-FUNCTION VALUE 'DEL'. 12 88 DUP-FUNCTION VALUE 'DUP'. 13 88 LOC-FUNCTION VALUE 'LOC' 'TOT'. 14 88 SCN-FUNCTION VALUE 'SCN'. 15 Move CURSOR to a line, use ERASE EOF to Delete it -or- PF20 to Insert After it Semicolon (;) is the TAB Character Asterisk (*) in col. 1 = suppress upcase Press PF24 for Instructions Press PF4 for Menu of Named Proformas ``` * Figure 30 — Customizing %FUNCT ## Forcing Key Value Next you will enter a bit of Customization to "force" a key value of "000000000", regardless of what is in the Screen Key field (SKEY), for the VACTOT function. There is an Insertion Point defined at the very start of the logic of the MMP's "Browse Mainline". It is named (cont.) %LOCINIT. This is a handy place to intercept the operator's entry and take action before the MMP has done much of its (cont.) standard logic. This is also the Insertion Point where you can do initialization of work fields. Hint:** In some of your applications you may wish to prefix the operator's entry with some constant value, such as his Client number, etc. **Do this:** Enter the command: ALGADD 600/LOCINIT/VACTOT/1 . . . press ENTER. Notice that we had you use a Modifier and Page number this time. There was no special reason, just for "drill". The Proforma for %LOCINIT makes it easy for you to "zero" work fields. The name ZEERO is defined in the MMP, it is the name of a constant in Working-Storage having a value of +0. ``` ALGADD 600/LOCINIT/VACTOT/1 ** SEARCH ARG: ................................................................ ... Password: M A G E C LOCINIT page New Password: CUSTOM ALGORITHM DEFINITION FOR MSK600 VACTOT (000) BROWSE FUNCTION INITIALIZATION TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40....;+...50....+...60....+...70.. move zeero to ------------ 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 Move CURSOR to a line, use ERASE EOF to Delete it -or- PF20 to Insert After it Semicolon (;) is the TAB Character Asterisk (*) in col. 1 = suppress upcase Press PF24 for Instructions Press PF4 for menu of Named Proformas ``` Figure 31 — Proforma for %LOCINIT ## Custom Code - %LOCINIT Do this:** Overkey the Proforma with the code shown, press ENTER. This new code will simulate that the operator has entered: VACTOT 000000000 by overlaying zeros in the Screen Key field. It also initializes four work fields to zero values. These four work fields are not yet defined. In the next step you will define them. **Note:** The field named SKEY is the actual screen field (on the top line) where the key value is entered. **Note:** When you are coding customization, you may occasionally wish to move underscores to screen fields to show the (cont.) operator how large a field is available for entry. MAGEC fills screen fields with underscores automatically at certain (cont.) appropriate times; however, you may want underscores filled into a screen field at some other time. MAGEC automatically (cont.) changes any underscores read in from the screen into spaces. This presents a bit of a problem when you are trying to (cont.) type underscores into your custom code, since they will be converted to spaces. To move one underscore character you can code: MOVE UNDERSCORE TO ..... there is a cosntant field defined in your Working Storage, and valued appropriately, to acommodate this. To move more than one, you can code: MOVE ALL '-' TO ..... where the character within the quotes is a symbolic (cont.) substitute for the underscore character. The substitute character on a mainframe is the Field-Mark. The substitute (cont.) character on a PC or network is the ASCII 197 character. To type this character depress the Alt key and hold it down, (cont.) on the numeric key pad type 1-9-7, the release the Alt key. Refer to the Librarian* section of your "Programmer's (cont.) Reference manual for more about underscores. ``` ALGADD 600/LOCINIT/VACTOT/1 ** SEARCH ARG: ................................................................ ... Password: M A G E C LOCINIT page New Password: CUSTOM ALGORITHM DEFINITION FOR MSK600 VACTOT (000) BROWSE FUNCTION INITIALIZATION TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40 ....;+...50....+...60....+...70.. ** IF VACTOT FUNCTION FORCE KEY VALUE OF ZEROS 01 IF SFUNCT = 'VACTOT' 02 MOVE '000000000' TO SKEY TEST-KEY 03 MOVE 0 TO VACATION-DUE-ALL 04 SICK-DUE-ALL 05 COMP-DUE-ALL 06 TOTAL-DUE-ALL. 07 08 09 Next: https://magec.com/DOC/markdown/cstm08.md.txt