Reviewing the list will show that you have indeed removed the field which we no longer want on the browses and replaced (cont.) it with the new one which we do want. Notice that the first four items show that they already have a Locate Heading (cont.) specified, you could change them if you needed to. Right now you have no need to change them, though. Notice that your (cont.) new field has no Locate Heading specified. If you did not specify one then MAGEC would default to the source/target (cont.) Cobol name. | ``` **     DO THIS: Move the cursor down to the line on which the new field (STOTDUE) is shown and press PF4.     ```** You have cursor-selected it to change it. The update screen for STOTDUE will immediately appear. | ``` ** SCDLST 600 END OF LIST - PF5=Restart/PF7=Backward MSK# ROW COL NAME OCCUR BROWSE HEADING & POSITION # LGTH SOURCE/TARGET 600 004 021 SEMPNUM (00 ) Emp# 1 0011 VAC01-EMPNUM 600 005 021 SFIRST (00 ) First Name 2 0015 SIF01-FIRST-NAME 600 006 021 SLAST-N (00 ) Last Name 3 0025 SIF01-LAST-NAME 600 007 021 SDATE-H (00 ) Hire Date 4 0008 VAC01-DATE-HIRED 600 _018 041 STOTDUE (00 ) 5 0013 TOTAL-DUE ++++ 38 Records Scanned, 05 Displayed so far - page 1 ++++ KEY 1 = MASK NUMBER Press PF13 for Hardcopy You may Position the CURSOR to an item and Press ENTER to "SEE" it (Browsing Forward) or Press PF4 to "CHG" it ```** Figure 23 -- List of Browse Fields for Mask 600 The cursor will automatically home to the only unprotected data field on this screen, "Locate Heading". You can enter (cont.) any literal up to 25 characters. You may use any characters except the apostrophe because the apostrophe has special (cont.) meaning to Cobol in literals. | ``` **     DO THIS: Key the literal shown on the exhibit and press ENTER.     ```** The update will be recorded. If you miskeyed you could just overkey with corrected data and press ENTER again. Now, let's go regenerate and compile. There is no need to regenerate the Mask, but it would not hurt anything to do so. We will not need the MSKCREAT job this time, just MMPCREAT. ** ** ** ** ** NOTE: ** Your terminal may be "hard-wired" to transform any lowercase alpha characters to uppercase. If so, the appearance of (cont.) your screens may be slightly different from the exhibits in this chapter. There is nothing to be concerned about, this (cont.) is normal. Notice that the identifying key in the Dictionary for your screen field's definition is made up or the Mask#, Row, and Column -- not the screen field's Cobol name (see top line of screen exhibit). | ``` ** SCDCHG 600 /018/041 M A G E C Locate Heading Definition Msk# 600 VACATION/SICK/COMP DAYS Row 018 Col 040 Length 0013 Screen Name STOTDUE (000) Database Source/Target TOTAL-DUE Locate Posn 5 Locate Heading: Days Due 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 Press PF24 for Pop-Up Short-List ```** Figure 24 -- Locate Heading Specification Screen ## Regenerate & Compile | ``` **     DO THIS: Press PF15 to exit MAGEC.     ```** | ``` **     DO THIS: Submit MMPCREAT for Mask 600.     ```** | ``` **     DO THIS: If you are using a mainframe, use the New Copy command appropriate in your environment.     ```** | ``` **     DO THIS: Use the TransID TS01 to get back into MAGEC to test your modified Browses.     ```** ## Test New Browses | ``` **     DO THIS: Key the command: VACLOC 1 . . . on top line and press ENTER.     ```** Your new Browse screen now shows the Total Days Due, a computed figure, in place of the Earned Vacation. This also means that your users can do Scans and Finds (VACSCN & VACFND) on Days Due now. You have completed this entire project without using the TSKLST once. In real life projects you would probably strike a (cont.) happy medium between always and never using it. It is always there if you want it. So far in these exercises we have worked entirely within the nine standard MAGEC functions: VACADD, VACCHG, VACLOC, etc. Next you will see how easy it is to add additional functions of your own. First, though, let's take a look at how Customization works in MAGEC. We will see exactly what MAGEC does to insert (cont.) your Custom Code into the generated MMP at the predefined Insertion Points. Refer to the ["Insertion (cont.) Points"](/DOC/magref_main.htm#MAGREF009001) reference table for a complete list. | ``` ** VACLOC 1 END OF LIST - PF5=Restart/PF7=Backward Emp# FIRST NAME LAST NAME Hire Date Days Due 000-00-0001 Harry Houdini 12/11/45 135.75 000-00-0002 Uri Geller 02/28/63 2.25 000-00-0003 Merlin The Magician 06/11/83 22.00 ++++ 03 Records Scanned, 03 Displayed so far - page 1 ++++ Key 1 = Employee# (9-digits) Press PF13 for Hardcopy You may position the CURSOR to an item and Press ENTER to "SEE" it (Browsing Forward) or Press PF4 to "CHG" it ```** Figure 25 -- Browse Display After Project 2 # Default, Custom, and Proforma Code ## Custom Code When you enter Cobol Customization coding into the MAGEC screens provided for that purpose (ALGADD, CHG, etc.) that (cont.) Cobol code is saved on the MAGEC Library file, the ALG file. As you have already seen, the name you use in the key (cont.) actually indicates which Customization insertion point your coding is to be used for. For instance: ALGADD 600/EDIT (Mask# 600, %EDIT insertion point) would add coding to be inserted at the %EDIT insertion point in the MMP. The %EDIT insertion point happens to be in the (cont.) paragraph BB500-SCREEN-EDIT which is performed before any database updating occurs for ADD, CHG, or DUP (cont.) functions. The coding you enter is called "Custom Code". ## Default Code When MAGEC's MMPCREAT job is generating your MMP it senses each of the insertion points by the percent markers (such as (cont.) %EDIT) and then it looks on the Library (ALG file) to see if there is some code to be inserted there. It (cont.) checks: First, if there is any Custom Code it gets it and inserts it. Second, if there is not any Custom Code, it next looks for Default Code for that insertion point, if there is some it inserts it. Last, if there is neither Custom nor Default code it just inserts a comment line and goes on. There is Default Code on file for all of the insertion points in MAGEC version 2.2 and later (Default Code is on file (cont.) for some*, not all, insertion points in previous releases). This Default Code is installed with the MAGEC system and is (cont.) a part of MAGEC, you cannot modify it. The Default Code is what we, the authors of MAGEC, determined to be the most likely thing that you will need at that (cont.) point. For instance, the insertion point named %REDKY has the Default Code to call the I/O module (MAGECIO) to read the (cont.) Primary Data Class' Elements. Most of the time the Default Code will be exactly what you need. On some projects you (cont.) might need to override this Default Code, though, with your own Custom Code. Just entering Custom Coding for %REDKY (cont.) will accomplish that; your Custom Code will be inserted instead of the Default Code. ## Logic of MMPCREAT at Insertion Points * **NOTE:** There will normally be default code in the library for every insertion point. Sometimes it will be a one-line comment--other times it will be more extensive Cobol coding. Figure 26 -- Flow Diagram of Insertion Logic ## Proforma Code In order to assist you in keying in your Custom Code MAGEC provides a "Proforma" on the screen whenever you do the (cont.) ALGADD function. A Proforma is simply an example of what your coding might look like for that particular insertion (cont.) point. The Proforma for any given insertion point would, of course, be different from the Proforma for another. There (cont.) is a Proforma for every insertion point. It is only seen when you do the ALGADD function to add new Custom (cont.) code. When you use the ALGADD function, MAGEC presents a screen ready for you to key your Cobol code into. Instead of just (cont.) presenting a "blank" screen, however, it presents a screen on which the appropriate Proforma is shown. In some cases (cont.) the Proforma could be used as a fill-in-the-blanks coding aid; you could just overkey what you wish to be different (cont.) from what is shown and leave the rest alone. When you press ENTER to let ALGADD actually add the code, it will take (cont.) whatever is on the screen at that time. You can always update it again, of course. The figure on the opposite page shows how the screen would be presented to you if you were **adding Customization for (cont.) %EDIT. When you are coding Custom editing to be done in the BB500-SCREEN-EDIT routine there are certain conventions you (cont.) should follow: Set the Error-Flag for the offending screen fields to "E" so they will automatically be highlighted. Move the appropriate error number to ERROR-NUMBER. PERFORM the CA100 routine. Since you will almost always want to follow that convention, we have established a Proforma for %EDIT which will (cont.) minimize the keystrokes you need to do. You can just overkey the displayed code (especially where the dashes are (cont.) shown). You could still overkey the entire Proforma with your own completely different code it you wished, but most of (cont.) the time the Proforma will reduce your work and keying errors. Proforma code exists solely to help you when keying in your Custom coding. It is merely something that MAGEC (ALGADD) (cont.) places on the screen to save you as many keystrokes as possible. It does not come from the Library, it is placed on the (cont.) screen for you from the ALGADD program. Many users find that the easiest and most flexible way to use the Proforma is as follows: 1) Key in ALGADD command      - proforma is displayed 2) Press ENTER      - proforma is added to Library as Custom code 3) Overkey changes      - 4) Press ENTER      - custom code is updated on Library ** ** NOTE: ** For most of the coding you will do in %EDIT you will simply have to overkey the dashed areas (---) and press ENTER. For (cont.) the rare exceptions you can overkey the entire screen with any other coding you desire. It is perfectly okay to use the (cont.) ERASE EOF key on your keyboard to delete lines. Blank lines will be "squeezed out" automatically. This Proforma shows an example of the coding for both a fatal error and a warning-level error. You choose the one appropriate for your edit and erase the other using the ERASE-EOF key. | ``` ** ALGADD 600/EDIT SEARCH ARG: ........................................................... ........ Password: M A G E C EDIT page New Password: CUSTOM ALGORITHM DEFINITION FOR MMP600 SCREEN FIELD EDIT(S) TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40....;+...50....+...60....+...70.. *-*-* CHECK FOR A FATAL ERROR 01 02 if -------------------- 03 move e to s------e 04 move '---' to error-number 05 perform ca100-load-err-code-tbl thru ca199-exit. 06 07 08 Next: https://magec.com/DOC/markdown/cstm04.md.txt