| ```
**     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
*-*-* CHECK FOR A NON-FATAL (WARNING) CONDITION 09
10
if -------------------- 11
move e to s------e 12
move '---' to error-number 13
perform ca400-load-warning-to-tbl thru ca499-exit. 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 27 -- Proforma Code for %EDIT
##
Another Proforma Example
In the case of the %REDKY insertion point, and many others, your Custom Code will usually be very similar to the (cont.)
Default Code with only minor changes or additions. For that reason you will notice that the Proforma looks just like (cont.)
the Default Code; you can simply overkey any changes or insert any additions. This saves you from having to rekey the (cont.)
entire Default routine with only a few changes. You can, if you need to, overkey the entire Proforma and thus replace (cont.)
the Default Code with an entirely different routine. This will be necessary only very rarely, maybe (cont.)
never.
You will find that the technique of first pressing ENTER to add the Proforma code to the Library and then overkeying, (cont.)
inserting, and deleting lines to modify it is especially useful here. When you press ENTER to initially add the code to (cont.)
the Library you will notice the function code on the top line of your screen change from ALGADD to ALGSEE. The PF keys (cont.)
to insert lines, etc, do not work in the **ALGADD function, they do work in the ALGNXT, ALGSEE, and ALGCHG (cont.)
functions.
If you look at the Cobol listing of the MMP before Customization was done for the %REDKY insertion point you would see (cont.)
the Default code that MAGEC inserted there. If you were to compare that Default code to the Proforma for %REDKY you (cont.)
would notice that they are nearly identical. That is because you usually need to deviate only slightly from the Default (cont.)
logic here, perhaps to insert a few lines of code just before or just after the CALL to MAGECIO. If there were no (cont.)
Proforma on the screen then you would have to key in the whole routine yourself.
Remember, the Proforma is only presented when you are doing the ALGADD function, not when you are doing ALGNXT or ALGCHG, etc. Once you have added code to the Library using
ALGADD you can then modify, add to, or delete it without restrictions.
NOTE:
**
In order to assist you to discern which portions of the proforma are duplicates of the default code, MAGEC displays (cont.)
those portions in all uppercase. In many cases you will notice that some lines are in uppercase with some lines in (cont.)
lowercase. The lowercase lines are merely suggested code to show you what might be done here.
You have the ability to overkey, or delete, any lines of the proforma, whether they are shown in uppercase or lowercase. This is just to help you to see the default coding you are customizing.
| ```
**
ALGADD 600/REDKY
SEARCH ARG: ................................................................
...
Password: M A G E C REDKY page
New Password: CUSTOM ALGORITHM DEFINITION FOR MSK600
READ FOR DISPLAY ROUTINE TAB Option (PF14=ON/OFF): ON
....+..;10.;..+;..20....+...30....+...40...;+...50....+...60....+...70..
PERFORM BA500-CHECK-FSTAT THRU BA599-EXIT. 01
IF (FILE-CLOSED) 02
GO TO AA900-GOBACK. 03
MOVE REDKY TO TWA-DB-CMD. 04
MOVE THIS-PGMS-ELEMENTS TO TWA-ELT-LIST. 05
CALL 'MAGECSET' USING TWA-DB-AREA-A 06
&ELTSET 07
PERFORM AA840-CALL-MAGEC-IO THRU AA899-EXIT. 08
MOVE AUDIT-STAMP TO SAVE-AUDIT-STAMP. 09
PERFORM JA100-LOGICAL-JOIN THRU JA199-EXIT. 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 28 -- Proforma for %REDKY
#
Named Proformas
##
The PF4 Key
Whenever you are doing the ALGADD function MAGEC presents a Proforma on the screen to help minimize your keystrokes (cont.)
(and opportunities for errors). The choice of which Proforma to present is based upon the insertion point (EDIT, REDKY, (cont.)
etc.) you are adding code for. In most cases the Proforma initially presented will be appropriate for what you are (cont.)
trying to do. However, in some cases, it might not be. If you believe that there might be a more useful Proforma than (cont.)
the one on the screen, you can press PF4 to request a menu (list) of "Named Proformas" to choose (cont.)
from.
This PF4 facility is available only for the ALGADD function. When you use it you will be presented a screenful of (cont.)
choices. Named Proformas are identified by an 8-character member name plus an 8-character modifier, much like ordinary (cont.)
library members (refer to the "Librarian" chapter). You can select one by positioning the cursor on it and pressing (cont.)
ENTER; it will then be displayed on your screen in lieu of the one which was previously being displayed. You can modify (cont.)

next: cstm08.md.txt