Reference manual for more about underscores. | ``` ** ALGADD 600/LOCINIT/VACTOT/1 SEARCH ARG: ................................................................ ... Password: M A G E C LOCINIT page New Password: CUSTOM ALGORITHM DEFINITION FOR MSK600 VACTOT (000) BROWSE FUNCTION INITIALIZATION TAB Option (PF14=ON/OFF): ON ....+..;10.;..+;..20....+...30....+...40 ....;+...50....+...60....+...70.. ** IF VACTOT FUNCTION FORCE KEY VALUE OF ZEROS 01 IF SFUNCT = 'VACTOT' 02 MOVE '000000000' TO SKEY TEST-KEY 03 MOVE 0 TO VACATION-DUE-ALL 04 SICK-DUE-ALL 05 COMP-DUE-ALL 06 TOTAL-DUE-ALL. 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 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 by using (cont.) the duplication and copying features. For example, in this step of the tutorial project you could copy lines 01 through (cont.) 04 from the pre-existing text and paste them just below, starting on line 05. (Line numbers are shown on the right (cont.) 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 Next: https://magec.com/DOC/markdown/cstm07.md.txt