2. Process the transaction as an ADD Function, Continuation Mode. ## LOC Function, New Transaction 1. Set NUMBER-OF-RECORDS to 16. 2. Normalize the entered key value and set the key name in the MAGECIO Request Area. 3. Position generically (LOCKY) using the Normalized key value. 4. If NOT-FOUND (end of data), move END OF DATA message to SCOMPL and to screen body and exit. 5. Read first record (REDLE). If NOT-FOUND, set DB ERROR message and exit, otherwise go to Step 7 below. 6. Read next record (REDNX), if NOT-FOUND, move END OF DATA message to SCOMPL and exit. 7. Build a display line from record data and move into screen. 8. If screen is full (determined by NUMBER-OF-RECORDS), move PF KEY DIRECTIONS message into SCOMPL and exit. 9. Go back to Step 6 above. ## LOC Function, Continuation 1. Set NUMBER-OF-RECORDS to 16. 2. Continue processing starting at Step 6 for New Transaction Mode above. ## SCN Function, New Transaction 1. Set NUMBER-OF-RECORDS to 16. 2. If Character Mask is "virgin", issue ENTER SELECTION MASK message and force the next transaction to also be a New Transaction Mode, exit. 3. Normalize the entered key value and set the key name in the MAGECIO Request Area. 4. Position generically (LOCKY) using the Normalized key value. 5. If NOT-FOUND (end of data), move END OF DATA message to SCOMPL and to screen body and exit. 6. Read first record (REDLE). If NOT-FOUND, set DB ERROR message and exit, otherwise go to Step 9 below. 7. If number of reads has reached the SCAN-LIMIT, simulate that the screen is full and go to Step 11 below. 8. Read next record (REDNX), if NOT-FOUND, move END OF DATA message to SCOMPL and exit. 9. Build display line from record data and compare to Selection Mask, if not a "hit", go to Step 7 above. 10. Move the display line into the screen. 11. If screen is full (determined by NUMBER-OF-RECORDS), move PF KEY DIRECTIONS message into SCOMPL and exit. 12. Go back to Step 7 above. ## SCN Function, Continuation 1. Set NUMBER-OF-RECORDS to 16. 2. Continue processing at Step 7 above in New Transaction Mode. ## FND Function, New Transaction 1. Set NUMBER-OF-RECORDS to 16. 2. If Search Argument is null, issue ENTER SEARCH ARGUMENT message and force the next transaction to also be a New Transaction Mode, exit. 3. Normalize the entered key value and set the key name in the MAGECIO Request Area. 4. Position into the file generically (LOCKY) using the Normalized key value. 5. If NOT-FOUND (end of data), move END OF DATA message to SCOMPL and to screen body and exit. 6. Read first record (REDLE). If NOT-FOUND, set DB ERROR message and exit, otherwise go to Step 9 below. 7. If number of reads has reached SCAN-LIMIT, simulate that the screen is full and go to Step 11 below. 8. Read next record (REDNX). If NOT-FOUND, move END OF DATA message to SCOMPL and exit. 9. Build display line from record data and compare to Search Argument(s), if not a "hit", go to Step 7 above. 10. Move the display line into the screen. 11. If screen is full (determined by NUMBER-OF-RECORDS), move PF KEY DIRECTIONS into SCOMPL and exit. 12. Go back to Step 7 above. ## FND Function, Continuation 1. Set NUMBER-OF-RECORDS to 16. 2. Continue processing at Step 7 above in New Transaction Mode. # Operating Environment ## MAGEC Control Program The MMP operates as a subordinate program to the MAGEC Control Program. Whenever an Operator makes an entry and presses (cont.) a transmit key to send the message to the CPU, the message is passed to the MAGEC Control Program (MAGECCP). MAGECCP (cont.) accepts the incoming message and formats it into the TWA-MSK-AREA where the Mask Copybook defines (cont.) it. MAGECCP performs the Automatic Edits and Security Validation and then passes control to the Cobol MMP -- if the (cont.) Operator is properly authorized. The MMP receives the message in the standard MAGEC Masking format and does not concern (cont.) itself with the mechanics of reading and writing to the terminal or handling the variable incoming and outgoing (cont.) formats. The MMP is actually portable, it can be executed in any MAGEC-supported environment. That includes MVS/CICS, (cont.) VSE/CICS, Westi, VM/CMS (with or without VM-CICS), and PC and PS/2 environments using MS-DOS, PC-DOS, or OS/2, and (cont.) LAN's. SInce all interface with the environmnet is handled by the MAGECCP program, the individual MMP's need not be aware of (cont.) the specifics of that environment. This enables the same MMP to operate in any supported enviroment with no program (cont.) changes. On a network the same MMP can be executed in character mode and in GUI (Graphical User Interface) mode (cont.) simultaneously. That is because the screen formatting and decoding is done externally to the MMP (cont.) itself. After receiving the formatted, edited, incoming message, the MMP does its processing. When it is ready to send the message back to the Operator it just exits, returning control back to MAGECCP. MAGECCP checks whether the FATAL-ERR flag has been set indicating that errors were detected by either the Automatic (cont.) Editing or by the Business Rule processing, or by the MMP's Custom editing. It sets the appropriate Error Messages (cont.) (from the ERR file) into the screen area if so. It then performs a compression routine to optimize the message (cont.) transmission and reformat it into the proper outgoing 3270, or other, format and then sends it to the Operator's (cont.) terminal. The work of the MMP is greatly simplified because it is relieved of the burdens of handling terminal message (cont.) peculiarities and because all the needed resources are gathered together and passed to it in the TWA area. If the (cont.) Operator is not authorized to do the Function he/she is attempting, then the MMP does not even receive control, a (cont.) Security Violation message is sent to the Operator instead. # Program Code ## ID Division ``` ID DIVISION. PROGRAM-ID. MMP600. *** VAC FILE MAINTENANCE AND BROWSE. AUTHOR. YOUR.NAME INSTALLATION. MAGEC.GENERATED.MMP DATE-COMPILED. 06/01/25-13:00:08. *REMARKS. ************************************************* * THIS MMP GENERATED BY * * MAGEC MMPCRE - A PROPRIETARY PRODUCT * * OF AL LEE & ASSOCIATES, INC. * * (214) 202-4965 * * THIS PROGRAM WAS CREATED, USING SHD * * NUMBER (MSK) 600,ON 06/01/25 AT * * 13:00:08 TO USE THE CICS MONITOR.* * "COPY BOOKS" ARE TO BE EXPANDED * * FROM THE MAGEC LIBRARY WHEN COMPILED.* * * * * * - - - GENERATED USING 'MODELMMP' - - - * * IT PROVIDES UPDATE AND DISPLAY FUNCTIONS * * AND BROWSES THE DATA CLASS VAC * * * * IT WILL PRODUCE A HARDCOPY OF THE SCREEN * * OR BROWSE LIST IF THE OPERATOR PRESSES * * THE PF13 KEY. * * * * * * BROWSES MAY BE DONE IN SEQUENCE BY: * * VACK1 - Employee# (9-digits) * * * * DEFAULT ALGORITHM %REMARKS STARTS HERE * * * DEFAULT ALGORITHM %REMARKS ENDS HERE ************************************************* ``` The Identification Division of the generated MMP is largely remarks. It gives an audit trail of what parameters were (cont.) used into the MMPCREAT Job Stream and when the MMP was generated and Compiled. The insertion point %REMARKS is where (cont.) you may insert your own comments to be generated into the MMP. ## Environment Division ``` ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-370. OBJECT-COMPUTER. IBM-370. **************************************************************** * * * NO ADDITIONAL CODING IS DONE IN THIS DIVISION FOR MMP'S * * * **************************************************************** ``` The Environment Division contains no coding for online MMP's and you may not add any coding of your own since there is no insertion point provided. ## Working Storage ``` DATA DIVISION. * * * DEFAULT ALGORITHM %SCHEMA STARTS HERE * * * NO STANDARD DEFAULT CODE FOR THIS INSERTION POINT * * * * * * DEFAULT ALGORITHM %SCHEMA ENDS HERE WORKING-STORAGE SECTION. SKIP2 01 CORE-MARK. SKIP2 **************************************************************** * * * THIS AREA IS GENERATED TO PROVIDE AN ID FOR EASIER * * LOCATION IN CORE DUMPS AND TO PROVIDE CONSTANTS FOR * * MMP, MSK, AND ELEMENT NAMES AND THE MASTER-KEY NAME. * * * **************************************************************** SKIP2 03 MMP-LIT PIC XXX VALUE 'MMP'. 03 THIS-MMP PIC XXX VALUE '600'. 03 DATE-TIME-GENERATED PIC X(18) VALUE '06/01/25-13:00:08'. 03 FILLER REDEFINES DATE-TIME-GENERATED. 05 DATE-GENERATED PIC X(9). 05 TIME-GENERATED PIC X(9). 03 MSK-CMD PIC XXX VALUE 'MSK'. 03 THIS-PGMS-MSK PIC XXX VALUE '600'. 03 COMMON-LOC-MSK PIC XXX VALUE '652'. 03 COMMON-POP-MSK PIC XXX VALUE '6PU'. 03 FILLER PIC X(32) VALUE 'VAC MAINT/LOCAT'. 03 MASTER-KEY-NAME PIC X(5) VALUE 'VACK1'. 03 FILLER REDEFINES MASTER-KEY-NAME. 05 FILLER PIC X(4). 05 MASTER-KEY-NO PIC X. 03 THIS-PGMS-ELEMENTS. 05 ELT-01 PIC X(6) VALUE 'VAC01 '. 05 FILLER PIC X(6) VALUE ' '. * * * BELOW IS FOR SPOOLER 01 SPOOL-ERR-MSG. 03 FILLER PIC X(06) VALUE 'ERROR '. 03 SPOOL-ERR-COD PIC X VALUE SPACE. 03 FILLER PIC X(20) VALUE ' FROM SPOOL-SUB ON '. 03 SPOOL-ERR-CMD PIC X(05) VALUE SPACE. 03 FILLER PIC X(12) VALUE ' FOR REPORT '. 03 SPOOL-ERR-RPT PIC X(4) VALUE SPACE. SKIP1 01 WS-TEST-REPORT-MSG. 03 FILLER PIC X(18) VALUE '&& REPORT NUMBER'. 03 WTR-REPORT-NO PIC X(4) VALUE SPACE. 03 FILLER PIC X(20) VALUE ' GENERATED &&'. SKIP2 01 PF-KEY-INSTRUCTIONS. 03 FILLER PIC X(40) VALUE SPACE. 03 FILLER PIC X(40) VALUE * 'Press PF13 for Hardcopy'. 03 FILLER PIC X(40) VALUE * ' You may Position the CURSOR on an item '. 03 FILLER PIC X(40) VALUE * 'and Press ENTER to "SEE" it'. 03 PFK-BROWSE-DIR PIC X(40) VALUE SPACE. 03 FILLER PIC X(40) VALUE * 'or Press PF4 to "CHG" it'. ``` The Working Storage section is used to contain literal constants only. The MMP never alters the data in Working (cont.) Storage. Any fields which are used as work areas or as the target fields for MOVE's or COMPUTE's must be in the TWA in (cont.) the Linkage Section. The exception to this rule is those cases in which the program will MOVE to a field in Working (cont.) Storage and will then access it without ever exiting (to do an I/O, for example) in between. In a fully reentrant (cont.) environment (see explanation below). the program should assume that Working Storage will be re-initialized when the (cont.) program receives control back after having exited. If you have trouble understanding this concept, play it safe. Don't (cont.) MOVE to Working Storage fields. **Reentrancy Next: https://magec.com/DOC/markdown/genmmp03.md.txt