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 32 — Custom Code for %LOCINIT ## More Variable-Storage Fields Now you need to define the new work fields which will be used to contain the totals you will be accumulating. Earlier (cont.) (in Project 1) you defined four work fields in the Variable-Storage area of the TWA. Now you will add four more. You (cont.) have already added the Custom code to initialize them, in %LOCINIT. You also need to add the definition of a work area (cont.) to be used to build the totals display. Do this:** Enter the command: ALGSEE 600/VARSTOR . . . press ENTER. The screen will be returned to you with the Function Code changed to ALGNXT, and with the existing Custom coding for %VARSTOR displayed. ``` ALGNXT 600/VARSTOR ** SEARCH ARG:............................................................ ...... Password: M A G E C VARSTOR page CUSTOM ALGORITHM DEFINITION FOR MSK600 (000) add items to VARIABLE STORAGE TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40....;+...50....+...60....+...70.. 05 VACATION-DUE PIC S9(7)V99 COMP-3 01 05 SICK-DUE PIC S9(7)V99 COMP-3 02 05 COMP-DUE PIC S9(7)V99 COMP-3 03 05 TOTAL-DUE PIC S9(7)V99 COMP-3 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 ``` Figure 33 — Variable-Storage Custom Code ## More Work Fields Do this:** Key the new definitions shown below, press ENTER. The Logical-Join routine is already calculating the "extended" figures for the first four work fields, we did that in Project 1. The four "ALL" fields will hold the accumulated tally of the corresponding extended figures. The group item named DISPLAY-LINE will be used to display the final totals. In order for the "ALL" fields to contain the correct totals, we must initialize them to zero (already done). Then, (cont.) after the extended figures have been computed, we must add the extended figures to their corresponding "ALL" fields. We (cont.) also must bypass displaying each individual employee's VAC data, and display only the final totals. There are strategically placed *Insertion Points *which make all this quite easy and straight forward. **Note:** Once you have become more familiar with MAGEC's online editor facility, you will be able to reduce your work (cont.) by using the duplication and copying features. For example, in this step of the tutorial project you could copy lines (cont.) 01 through 04 from the pre-existing text and paste them just below, starting on line 05. (Line numbers are shown on the (cont.) right margin of the screen). To copy lines you would overtype the line numbers with a "CC" to indicate the starting and (cont.) ending lines to be copied, then press the PF16 key. To paste those lines you would position the cursor to the first (cont.) blank line after the existing text (line 05), and press PF17. You could then modify the newly pasted lines and press (cont.) ENTER to update. You could also type more lines of text below them. If you wished to copy only one line it is not necessary to type "CC" over any of the line numbers, you simply place the (cont.) cursor onto the line to be copied and press PF16. PF16 and PF17 are the standard copy/paste keys throughout MAGEC, they (cont.) work in your generated applications as well. ``` ALGNXT 600/VARSTOR ** SEARCH ARG:.................................................................. Password: M A G E C VARSTOR page CUSTOM ALGORITHM DEFINITION FOR MSK600 (000) add items to VARIABLE STORAGE TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+..40 ....;+...50....+...60....+...70.. 05 VACATION-DUE PIC S9(7)V99 COMP-3 01 05 SICK-DUE PIC S9(7)V99 COMP-3 02 05 COMP-DUE PIC S9(7)V99 COMP-3 03 05 TOTAL-DUE PIC S9(7)V99 COMP-3 04 ;;05 VACATION-DUE-ALL;PIC S9(7)V99 COMP-3 05 ;;05 SICK-DUE-ALL;PIC S9(7)V99 COMP-3 06 ;;05 COMP-DUE-ALL;PIC S9(7)V99 COMP-3 07 ;;05 TOTAL-DUE-ALL;PIC S9(7)V99 COMP-3 08 ;;05 DISPLAY-LINE. 09 ;; 07 DISPLAY-TITLE;PIC X(20). 10 ;; 07 DISPLAY-TOTAL;PIC ZZZ,ZZZ,ZZ9.99-. 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 ``` Figure 34 — More Variable-Storage Custom Code ## Controlling the Browse Display The %SELECT Insertion Point is provided to allow you to control what will be displayed on the browse screens. All of (cont.) the browse functions (VACLOC, VACSCN, VACFND, and VACTOT) can be controlled by your Custom coding (cont.) here. Do this:** Enter the command: ALGADD 600/SELECT/VACTOT/1 . . . press ENTER. **Do this:** Press ENTER again to add the code from the screen to the dictionary as customization code--this puts you into "edit mode" rather than "add mode". Coding for %SELECT is inserted just before the MMP builds the line of display data for each item (employee). There is an indicator which you can set to tell the MMP to: Bypass displaying this item (B) Simulate END-OF-DATA (E) Process this item normally (P) The name of it is PROCESS-INDICATOR. You are going to enter Custom coding here to bypass displaying any items and accumulate and display the totals (if the (cont.) function is VACTOT). There will be more than one page (15 lines) of coding needed. You will, therefore, add two pages (cont.) of Customization for %SELECT. ``` ALGADD 600/SELECT/VACTOT/1 ** SEARCH ARG: ................................................................ ... Password: M A G E C SELECT page New Password: CUSTOM ALGORITHM DEFINITION FOR MSK600 VACTOT (000) SELECTION CRITERIA FOR BROWSES TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40....;+...50....+...60....+...70.. if (----function) 01 if ------------ greater ---------------- 02 move e to process-indicator 03 else 04 if -------------- = -------------- 05 move b to process-indicator. 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 35 — Proforma for %SELECT ## Custom Browse Display Do this:** Key in the code shown for the first page - press ENTER. The ALGNXT screen will be returned showing your first page of coding. ``` ALGNXT 600/SELECT/VACTOT/1 ** SEARCH ARG:............................................................ ...... Password: M A G E C SELECT page CUSTOM ALGORITHM DEFINITION FOR MSK600 VACTOT (001) SELECTION CRITERIA FOR BROWSES TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40....+...50....+...60....+...70.. IF SFUNCT = 'VACTOT' 01 MOVE B TO PROCESS-INDICATOR 02 ADD VACATION-DUE TO VACATION-DUE-ALL 03 ADD SICK-DUE TO SICK-DUE-ALL 04 ADD COMP-DUE TO COMP-DUE-ALL 05 ADD TOTAL-DUE TO TOTAL-DUE-ALL 06 MOVE 'VACATION DAYS ======' TO DISPLAY-TITLE 07 MOVE VACATION-DUE-ALL TO DISPLAY-TOTAL 08 MOVE DISPLAY-LINE TO MSK652-SLINE (1) 09 MOVE 'SICK DAYS ==========' TO DISPLAY-TITLE 10 MOVE SICK-DUE-ALL TO DISPLAY-TOTAL 11 MOVE DISPLAY-LINE TO MSK652-SLINE (2) 12 MOVE 'COMP DAYS ==========' TO DISPLAY-TITLE 13 MOVE COMP-DUE-ALL TO DISPLAY-TOTAL 14 MOVE DISPLAY-LINE TO MSK652-SLINE (3) 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 ``` Figure 36 — First Page of Custom Code for %SELECT Next, use ALGADD again to add page 2. Do this:** Alter the command to: ALGADD 600/SELECT/VACTOT/2 . . . press ENTER. The %SELECT Proforma will reappear (not shown on opposite page) ready for you to enter more Custom coding to be inserted into the SELECT Insertion Point. **Do this:** Overkey the Proforma exactly as shown - press ENTER. Again, the ALGNXT screen will display your second page of Custom code. You can page forward and backward to visually scan your coding, by pressing the PF8 and PF7 keys, respectively. **Note:** After you have keyed in the first page of text (as in Figure 36) you could cause MAGEC to automatically (cont.) create page 2 rather than having to manually type the ALGADD command as above. To do that you would place the cursor (cont.) anywhere in the body of your text, but above line 15, and press PF20. PF20 is the insert key, it causes the screen to (cont.) "open up" in preparation for you to insert more text after the line your cursor was on and before the line following (cont.) it. When you do that on a screen which is already full (all 15 lines used) MAGEC will automatically add another page to (cont.) contain the overflow, even if you do not key any more lines into the opened up screen. Then just pressing ENTER will (cont.) update the member; the last line from page 1 will be overflowed to the new page 2. Now, pressing PF8, or just ENTER (cont.) again, will page forward to page 2. Since you would not be doing the ALGADD function MAGEC would not present the (cont.) proforma, either. **Note:** The work field named LIN-CTR is a subscript used by the standard logic when it moves the display lines into (cont.) the screen. It is also tested in the mainline to determine whether the screen is full. ``` ALGNXT 600/SELECT/VACTOT/2 Data ADDED to Database ** SEARCH ARG:............................................................ ...... Password: M A G E C SELECT page CUSTOM ALGORITHM DEFINITION FOR MSK600 VACTOT (002) SELECTION CRITERIA FOR BROWSES TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40....+...50....+...60....+...70.. MOVE 'TOTAL DAYS =========' TO DISPLAY-TITLE 01 MOVE TOTAL-DUE-ALL TO DISPLAY-TOTAL 02 MOVE DISPLAY-LINE TO MSK652-SLINE (4) 03 MOVE FIVE TO LIN-CTR 04 MOVE 'TOTALS - ALL EMPLOYEES' TO MSK652-SHDG. 05 06 07 08 09 10 11 Next: https://magec.com/DOC/markdown/cstm09.md.txt