IF WS-LINE-SELECTED GREATER THAN ZEERO MOVE WS-LINE-SELECTED TO TWA-SV-M-SUB MOVE TWA-SV-M-KEY (WS-LINE-SELECTED) TO TEST-KEY PERFORM CA500-MOVE-SKEY THRU CA599-EXIT IF (TWA-MSK-PF4-HIT) MOVE QUOTE TO TWA-MSK-AID MOVE WS-CHG-FUNCT TO MSK652-SFUNCT GO TO AA760-ATTACH ELSE MOVE WS-SEE-FUNCT TO MSK652-SFUNCT GO TO AA760-ATTACH. ```** The AAL200 routine is the beginning of the Mainline logic for the LOC, SCN, and FND Functions (Browses). It first makes (cont.) sure that the screen is formatted with the correct Mask (MSK652) for Browses, if needed it will initialize the (cont.) TWA-MSK-AREA by reading the MSK record. It then sets the MMP-NEW-TRANSACTION indicator depending on whether the (cont.) Operator has altered the Function or Key on the screen. Refer to Appendix B at the back of this (cont.) section. The default logic for the insertion point %PFKEYL supports the standard help key (PF1), the standard copy key (PF16), (cont.) the standard help index key (PF11), and the standard browse keys (PF8=forward, PF7=backward) If in Continuation Mode then it checks the Cursor position to see if the Operator has Cursor-Selected an item, if so (cont.) then it performs the CA500 routine to convert the saved Master Key value for the selected record into the proper screen (cont.) format with slashes (/) separating the component fields, etc.. It uses the "ATTACH" technique to invoke the designated (cont.) Function depending on whether the ENTER or PF4 key was hit. The insertion point provided here named %PFKEYL is you so that you can enter Customization logic to intercept the (cont.) incoming transaction very early in the processing. One of the primary uses for PFKEYL is to test for the Operator's (cont.) having used a certain PF key to indicate that he/she wishes to transfer to some other Function. You could also use this (cont.) point to intercept and modify the Key Value entered before the Normalize Key routine gets to it, perhaps to prefix it (cont.) with the proper Company number or Department number, etc. so that an Operator can only access records for his/her own (cont.) Company or Department. | ``` ** **************************************************************** * AAL250 * * THIS ROUTINE PERFORMS GENERAL HOUSEKEEPING, INITIALIZING * * AND BUILDING APPROPRIATE DATA FIELDS. * **************************************************************** AAL250-SEND-FOR-KEY. MOVE SPACES TO MSK652-SLIST. MOVE MASTER-KEY-NAME TO TWA-DB-KEY-NAME. IF TEST-KEY EQUAL SPACES ADD ONE TO TWA-J-CTR IF TWA-J-CTR GREATER THAN TWO MOVE MSG-LIT TO TWA-TP-OP MOVE GOIN-NOWHERE-MSG TO TWA-MSK-DETAIL MOVE CLEAR-FUNCT TO MSK652-SFUNCT MOVE FTH-FUNCT TO TWA-NONTP-REQUEST GO TO AA900-GOBACK ELSE MOVE EIGHT TO TWA-MSK-CUR-AD-OT MOVE ENTER-KEY-MSG TO MSK652-SCOMPL GO TO AAL750-LEAVE-CUR-SND-SCRN. MOVE ZEERO TO TWA-J-CTR. ```** The AAL250 routine checks for users who continue tapping the ENTER key after reaching end-of-data or without entering a (cont.) key value. Without a key value the Operator is "going nowhere", if he/she transmits three times in a row without (cont.) entering a key value then the MMP issues a message via the FTH-FUNCT command as above. | ``` ** AAL300-INITIALIZE. PERFORM BA200-INIT-ATTRIBUTES THRU BA299-EXIT. MOVE TEST-FUNCT TO TWA-LAST-FUNCT. IF (FND-FUNCTION) PERFORM DA300-CALC-SEARCH-LGTH THRU DA399-EXIT IF ZEERO = SEARCH-LGTHA AND SEARCH-LGTHB MOVE MSK652-SSEARCH-POSN TO TWA-MSK-CUR-AD-OT MOVE SCANS-LIT TO TWA-DB-CMD MOVE NOT-FOUND-LIT TO TWA-DB-RETURN-CODE MOVE TWA-DB-REQUEST TO TWA-DB-REQ-SAV IF SARG-SUB GREATER THAN ZEERO ADD SARG-SUB TO TWA-MSK-CUR-AD-OT MOVE CURSOR-POINTING-MSG TO ESM-ERRMSG MOVE ENTER-SEARCH-MSG TO MSK652-SLIST GO TO AAL750-LEAVE-CUR-SND-SCRN ELSE MOVE LOW-VALUES TO ESM-ERRMSG MOVE ENTER-SEARCH-MSG TO MSK652-SLIST GO TO AAL750-LEAVE-CUR-SND-SCRN. IF (SCN-FUNCTION) MOVE MSK652-SDOTMSK TO WS-ITEM PERFORM BA106-BLANK-FIL THRU BA107-EXIT MOVE WS-ITEM TO MSK652-SDOTMSK MOVE SPACES TO WS-ITEM IF (MSK652-SDOTMSK = MSK-DOT-LINE79) MOVE MSK652-SDOTMSK-POSN TO TWA-MSK-CUR-AD-OT MOVE SCANS-LIT TO TWA-DB-CMD MOVE NOT-FOUND-LIT TO TWA-DB-RETURN-CODE MOVE TWA-DB-REQUEST TO TWA-DB-REQ-SAV MOVE ENTER-DOTMSK-MSG TO MSK652-SLIST GO TO AAL750-LEAVE-CUR-SND-SCRN. IF (SCN-FUNCTION) OR (FND-FUNCTION) MOVE MSK652-SDOTMSK TO MSK-DOT-LINE ELSE MOVE SPACES TO MSK-DOT-LINE MSK652-SDOTMSK TEST-DOT-LINE. IF (FND-FUNCTION) PERFORM DA200-FIND-PARENS THRU DA299-EXIT IF (ERROR-FOUND) MOVE SPACE TO FATAL-ERR MOVE MSK652-SDOTMSK-POSN TO TWA-MSK-CUR-AD-OT ADD DOT-SUB TO TWA-MSK-CUR-AD-OT MOVE SCANS-LIT TO TWA-DB-CMD MOVE NOT-FOUND-LIT TO TWA-DB-RETURN-CODE MOVE TWA-DB-REQUEST TO TWA-DB-REQ-SAV MOVE CURSOR-POINTING-MSG TO ESM-ERRMSG MOVE ENTER-SEARCH-MSG TO MSK652-SLIST GO TO AAL750-LEAVE-CUR-SND-SCRN ELSE IF (SEARCH-LGTHA GREATER THAN (SEARCH-STOP + ONE - SEARCH-START)) THEN MOVE MSK652-SDOTMSK-POSN TO TWA-MSK-CUR-AD-OT MOVE SCANS-LIT TO TWA-DB-CMD MOVE NOT-FOUND-LIT TO TWA-DB-RETURN-CODE MOVE TWA-DB-REQUEST TO TWA-DB-REQ-SAV MOVE SHORT-SCAN-AREA-MSG TO MSK652-SLIST GO TO AAL750-LEAVE-CUR-SND-SCRN. IF (TWA-MSK-PF5-HIT) MOVE F TO TWA-BROWSE-DIRECTION MOVE N TO MMP-NEW-TRANSACTION. IF (NEW-TRANSACTION-MODE) IF TEST-KEY EQUAL SPACES MOVE EIGHT TO TWA-MSK-CUR-AD-OT MOVE E TO MSK652-SKEYE MOVE ENTER-KEY-MSG TO MSK652-SCOMPL GO TO AAL750-LEAVE-CUR-SND-SCRN ELSE PERFORM BA300-NORMALIZE-KEY THRU BA399-EXIT IF SKEYE EQUAL E MOVE EIGHT TO TWA-MSK-CUR-AD-OT MOVE INVALID-KEY-MSG TO MSK652-SCOMPL GO TO AAL750-LEAVE-CUR-SND-SCRN. MOVE TEST-FUNCT TO TWA-LAST-FUNCT. MOVE NEXT-PAG-MSG TO MSK652-SCOMPL. IF (BROWSE-BACKWARD) MOVE BROWSING-BACKWARDS TO TWA-SERRMSG-MSG (5) ELSE MOVE BROWSING-FORWARDS TO TWA-SERRMSG-MSG (5). ```** The AAL300 routine initializes the screen attributes and parses the SCN Function's Selection Mask line or the FND (cont.) Function's Search Arguments. It forces the MMP into New Transaction Mode if the Operator hit PF5, this will return the (cont.) screen's display to the first "page" instead of "paging forward". If in New Transaction Mode it performs the Normalize (cont.) Key routine to edit and format the entered Key Value in preparation for reading the file. It tests the (cont.) TWA-BROWSE-DIRECTION indicator to see whether the REDNX command will read forward or backwards and moves an appropriate (cont.) message into the last line of the screen. | ``` ** **************************************************************** * AAL400 * * THIS ROUTINE POSITIONS TO THE FIRST DATABASE RECORD * * HAVING A KEY VALUE EQUAL TO OR GREATER THAN THAT * * GIVEN IN 'SKEY' THEN READS IT AND READS 'NEXT' UNTIL * * THE SCREEN IS FILLED OR END-OF-DATA IS REACHED. * * THE MAXIMUM NUMBER OF RECORDS TO BE PLACED ON THE * * SCREEN IS SPECIFIED IN 'NUMBER-OF-RECORDS' IN VARIABLE * * STORAGE. * **************************************************************** AAL400-DB-IO. IF (NEW-TRANSACTION-MODE) MOVE ZEERO TO CUMULATIVE-SCAN-CTR CUMULATIVE-DSPLY-CTR MOVE ONE TO PAGE-CTR GO TO AAL410-SET-STARTING-POSITION. MOVE TWA-DB-REQ-SAV TO TWA-DB-REQUEST. IF (REC-FOUND) NEXT SENTENCE ELSE GO TO AAL430-READ-NEXT-RECORD. IF (BROWSE-FORWARD) COMPUTE PAGE-CTR = PAGE-CTR + ONE ELSE COMPUTE PAGE-CTR = PAGE-CTR - ONE. IF PAGE-CTR EQUAL ZEERO IF (BROWSE-FORWARD) MOVE ONE TO PAGE-CTR ELSE MOVE MINUS-ONE TO PAGE-CTR. GO TO AAL430-READ-NEXT-RECORD. AAL410-SET-STARTING-POSITION. MOVE START-LIT TO SPOOL-REQUEST-AREA. * * * DEFAULT ALGORITHM %LOCKY STARTS HERE MOVE KEY-NAME TO TWA-DB-KEY-NAME. PERFORM BA500-CHECK-FSTAT THRU BA599-EXIT. IF (FILE-CLOSED) GO TO AA900-GOBACK. MOVE LOCKY TO TWA-DB-CMD. MOVE NORMALIZED-KEY TO TWA-KEY-VALUE. MOVE THIS-PGMS-ELEMENTS TO TWA-ELT-LIST. CALL 'MAGECSET' USING TWA-DB-AREA-A VAC01-ELEMENT PERFORM AA840-CALL-MAGEC-IO THRU AA899-EXIT. * * * DEFAULT ALGORITHM %LOCKY ENDS HERE GO TO AAL440-TEST-RETURN-CODE. AAL420-READ-FIRST-RECORD. * * * DEFAULT ALGORITHM %REDLE STARTS HERE * * * THE REDLE LOGIC IS HANDLED IN THE READ-NEXT ROUTINE GO TO AAL430-READ-NEXT-RECORD. * * * DEFAULT ALGORITHM %REDLE ENDS HERE GO TO AAL440-TEST-RETURN-CODE. AAL430-READ-NEXT-RECORD. Next: https://magec.com/DOC/markdown/genmmp10.md.txt