```
Figure 19 — Selecting a Variable for "Change"
## Remove Locate Position
The last characteristic displayed, in the bottom line of the pop-up window is LOC. This is the Locate Position. The Earned Vacation is the fifth Data Item (left to right) on the Browse screen.
Do this:** Alter the Locate Position from "5" to "0", press ENTER.
The change will be recorded on the Dictionary and Mask 600 will be redisplayed to you ready for further action.
```
MSKDEF 600 -- HIT ENTER TO CHANGE --
** Date:@ > @VACATION/SICK/COMP DAYS> @Time:@XX:XX:XX>
@Emp#@999-99-9999>
@First Name@--------------->
@Last Name@------------------------>
@Hire Date@-------->
@Earned Vacation@---------->
@Vacation Taken@----------> @Due@------------->
@Sick Days Earned@---------->
@Sick Days Taken@----------> @Due@------------->
@Comp Days Earned@---------->
@Comp Days Taken@----------> @Due@------------->
@Comments (3 lines)@---------------------------------------------->
@---------------------------------------------->
@---------------------------------------------->
@Total Days Due@------------->
MAGEC SCREEN PAINTER (PFKEYS) --FIELD: 18=CHG 19=DEL 20=DUP 21=MOVE
LAST GEN=93 08 05 --LINE: 4=DUP 5=ERASE 6=MOVE 13=DEL 15=INS
LAST UPD=93 06 22 2494 BYTES MAX, 1151 USED, 1343 LEFT PF24=POP-UP HELP
```
*
Figure 20 — Changing Locate Position to "0"
## Selecting a Field to Add to the Browse
Next we will add the Total Days Due variable field to our browse display.
Do this:** Cursor select the Total Days Due variable, press PF18.
```
MSKDEF 600 ++ FIELD DATA CHANGED ++
** Date:@ > @VACATION/SICK/COMP DAYS> @Time:@XX:XX:XX>
@Emp#@999-99-9999>
@First Name@--------------->
@Last Name@------------------------>
@Hire Date@-------->
@Earned Vacation@---------->
@Vacation Taken@----------> @Due@ >
@Sick Days Earned@---------->
@Sick Days Taken@----------> @Due@------------->
@Comp Days Earned@---------->
@Comp Days Taken@----------> @Due@------------->
@Comments (3 lines)@---------------------------------------------->
@---------------------------------------------->
@---------------------------------------------->
@Total Days Due@------------->
MAGEC SCREEN PAINTER (PFKEYS) --FIELD: 18=CHG 19=DEL 20=DUP 21=MOVE
LAST GEN=93 08 05 --LINE: 4=DUP 5=ERASE 6=MOVE 13=DEL 15=INS
LAST UPD=93 06 22 2494 BYTES MAX, 1151 USED, 1343 LEFT PF24=POP-UP HELP
```
Figure 21 — Adding a Field to Browse Screen
## Adding a Field to Browse Screen
The bottom three rows now show the characteristics for the Total Days Due variable. The Locate Position is a "0". That (cont.)
means that this field does not appear on the Browse screens. You are going to change that.
Do this:** Key: "5" into the Locate Position, press ENTER.
Your change will be recorded and Mask 600 will be redisplayed.
**Note:** At this point you have done all that is necessary to accomplish this project. All that is left is to (cont.)
regenerate and compile the MMP and, of course, test. You have removed one field from the Browse and you have added (cont.)
another. Please remember the way the Browse screen looked at the start of this exercise. Remember those Locate (cont.)
Headings?
If you do nothing more now, MAGEC will generate a default Locate Heading for this new field on the Browse screen. The (cont.)
default name that it generates will be the Cobol source/target field name. That may be OK, but it is not the most (cont.)
decorative possible heading. Therefore, you will next specify the Locate Heading you wish MAGEC to use instead of (cont.)
generating a default.
```
MSKDEF 600 -- HIT ENTER TO CHANGE --
** Date:@ > @VACATION/SICK/COMP DAYS> @Time:@XX:XX:XX>
@Emp#@999-99-9999>
@First Name@--------------->
@Last Name@------------------------>
@Hire Date@-------->
@Earned Vacation@---------->
@Vacation Taken@----------> @Due@------------->
@Sick Days Earned@---------->
@Sick Days Taken@----------> @Due@------------->
@Comp Days Earned@---------->
@Comp Days Taken@----------> @Due@------------->
@Comments (3 lines)@---------------------------------------------->
@---------------------------------------------->
@---------------------------------------------->
@Total Days Due@------------->
MAGEC SCREEN PAINTER (PFKEYS) --FIELD: 18=CHG 19=DEL 20=DUP 21=MOVE
LAST GEN=93 08 05 --LINE: 4=DUP 5=ERASE 6=MOVE 13=DEL 15=INS
LAST UPD=93 06 22 2494 BYTES MAX, 1151 USED, 1343 LEFT PF24=POP-UP HELP
```
Figure 22 — Changing Locate Position from "0" to "5"
## Specifying a Locate Heading
First you should obtain a "menu" list of the screen fields from Mask 600 which are to appear on the Browse. There is a (cont.)
handy online function to do just that for you. It is called Screen Detail List (SCDLST).
Do this:** Key the command: SCDLST 600 . . . on the top line, press ENTER.
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 (cont.)
appearance of your screens may be slightly different from the exhibits in this chapter. There is nothing to be (cont.)
concerned about, this 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/25 135.75
000-00-0002 Uri Geller 02/13/21 2.25
000-00-0003 Merlin The Magician 01/21/20 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
Next: https://magec.com/DOC/markdown/cstm06.md.txt