*-*-* 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.) it by overkeying, if you like, and press ENTER to add it to the dictionary as **customization code to be inserted into the program. ## Your Own Proformas When MAGEC is installed, it includes a set of Named Proformas which most users find to be helpful. These include such (cont.) things as SQL, IMS/DLI, and other database access calls. You are free to use these in any applications where (cont.) appropriate. You can also modify or delete them, or add your own Named Proformas via the online and/or batch facilities (cont.) provided. The online functions used to do this are: PROADD mmmmmmmm/nnnnnnnn     PROCHG mmmmmmmm/nnnnnnnn     PRODEL mmmmmmmm/nnnnnnnn     PROSEE mmmmmmmm/nnnnnnnn     PRONXT mmmmmmmm/nnnnnnnn     PROLOC 1/mmmmmmmm/nnnnnnnn     The key in all cases consists of the 8-character member name (mmmmmmmm) followed by the 8-character modifier (cont.) (nnnnnnnn). In the PROLOC function the key may be incomplete or just "1". Named Proformas are very similar to any other (cont.) library member except that they are limited in size to one screenful, 15 lines, of code. You can make up names for them (cont.) which help the developer identify what they do. For example, if you were adding a Named Profroma to call your "home (cont.) grown" rate calculation subroutine, you might name it "RATE/CALC". You would add it to the dictionary using the (cont.) command: PROADD RATE/CALCYou can use the MAGECLBR batch utility program to add, replace, list, or punch out Named Proformas using the control cards: -MAGECADD PRO mmmmmmmm/nnnnnnnn     -MAGECREP PRO mmmmmmmm/nnnnnnnn     -MAGECLST PRO mmmmmmmm/nnnnnnnn     -MAGECPUN PRO mmmmmmmm/nnnnnnnn     -MAGECPUN PRO     where: mmmmmmmm               = 8-character member name nnnnnnnn               = 8-character modifier If you use the -MAGECPUN PRO with the member and modifier names omitted then the program will punch out all the Named (cont.) Proformas with separator control cards between them. The separators are actually -MAGECREP control cards so that the (cont.) output can be turned around and used as input to MAGECLBR to recatalogue the members. This facilitates exporting them (cont.) to another text editor, modifying them, and importing the results back to the MAGEC dictionary. # Modifiers & Page Numbers ## ALG Key Structure In all the examples we have used so far the key structure for the Customization Algorithms has only contained two components. For example: 600/EDIT   where: 600               = Mask "number" EDIT               = Insertion Point name Actually there are four (4) components to the key. The other two assume default values, if we do not specify them, such as: 600/EDIT/mmmmmmmm/ppp     where: 600               = Mask number EDIT               = Insertion Point name mmmmmmmm               = Modifier ppp               = Page number The Modifier (8-character) is optional and will default to spaces if you do not enter it. The Page number (3-digit) is also optional and will default to zeros if you do not enter it. When MMPCREAT is inserting your Custom coding, it seeks all the records from the Library having a key in which the Mask (cont.) number and the Insertion Point name match the Mask number and Insertion Point being processed. MMPCREAT considers the (cont.) 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 Next: https://magec.com/DOC/markdown/cstm05.md.txt