an appropriate value in TWA-DB-RETURN-CODE so that the standard MMP logic can work as usual.
Do not forget JA100-LOGICAL-JOIN!
###
Online Insertion Point
%REDKY
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM410-READ-BY-KEY
Description:
This logic is executed in the NEW-TRANSACTION-MODE of the MAINT-FUNCTION's. It is executed only if the Normalize Key (cont.)
routine has found no errors in the key value given (in SKEY). The default logic for %REDKY tests the file's status (cont.)
(open or closed) using the FSTAT command to the MAGEC I/O module, then uses the REDKY command to read the Primary Data (cont.)
Class using the key value from NORMALIZED-KEY. It then PERFORM's the JA100-LOGICAL-JOIN routine to execute your %JOIN (cont.)
code to Logically Join data from other files or from calculations. The result is the Logical Record for this (cont.)
function.
The default also saves the Audit-Stamp so it can be compared later in the %RDUKY logic.
Suggested Uses:
You may read a non-MAGEC file or database by replacing the default code with your own. Or you may make minor modifications or additions to the default logic.
When you begin to add your custom code for %REDKY you will be presented a Proforma which is very similar to the default logic. You may overkey it entirely or in part to make any changes you wish.
You may wish to check the record for non-numerics in numeric fields and set them to zero. This is sometimes useful when (cont.)
new fields are added to a record (Element) definition where a FILLER used to be.
Cautions:
Be sure you exit this routine by GO'ing to AAM440-TEST-RETURN-CODE or by falling through to the GO TO which is immediately behind the %REDKY insertion point.
If you do not call the MAGEC I/O module then you should be sure to set the TWA-DB-RETURN-CODE appropriately so that the (cont.)
subsequent logic of the MMP will properly recognize the REC-FOUND or NOT-FOUND conditions.
###
Online Insertion Point
%REDLE
Found in Model:
MODELMMP MODLOCAT  MODELWIN
Location:
PROCEDURE DIVISION -- AAL420-READ-FIRST-RECORD
Description:
This logic is executed for BROWS-FUNCTION's only, and only in the NEW-TRANSACTION-MODE. It is executed after the %LOCKY (cont.)
logic and only if the LOCKY was successful. This logic is to read the record you have positioned to in (cont.)
%LOCKY.
The default code merely GO's to AAL430-READ-NEXT-RECORD to do the read.
Suggested Uses:
You may want to code your own read to a non-MAGEC file or database.
Cautions:
To exit the routine be sure you GO TO AAL440-TEST-RETURN-CODE. Be sure you alter the TWA-DB-CMD from LOCKY to another (cont.)
command since LOCKY will cause the AAL440 routine to loop back to the AAL420 routine endlessly.
If you do your own I/O be sure to set the TWA-DB-RETURN-CODE appropriately so the subsequent MMP logic will work properly.
###
Online Insertion Point
%REDNX
Found in Model:
MODELMMP (2 places) MODELWIN MODLOCAT
Location:
PROCEDURE DIVISION -- AAL430-READ-NEXT-RECORD
, AAM430-READ-NEXT-RECORD
Description:
This logic is executed in both BROWS-FUNCTION's and in MAINT-FUNCTION's. It is the logic to read "pseudo-sequentially", (cont.)
either forward or backward. The direction is controlled in the MAGEC I/O module based on the value of (cont.)
TWA-BROWSE-DIRECTION (F or B).
The default logic for %REDNX calls the MAGEC I/O module, then it PERFORM's JA100-LOGICAL-JOIN.
It is executed for xxxLOC, xxxSCN, xxxFND, and xxxNXT functions.
Suggested Uses:
You might want to do I/O to non-MAGEC files or databases instead of using the MAGEC I/O module.
You might want to check some data in the record (Elements) just read so you can bypass some (such as wrong record type or wrong company).
You may want to skip over entire groups of records based on the high-order position of the key value. You could do a LOCKY followed by REDLE to reposition past them.
You can simulate end-of-file by MOVE'ing '14' to TWA-DB-RETURN-CODE and allowing the logic to fall through to the test-return-code routine (see Cautions).
Cautions:
This logic will be used in both the Browse and Maintenance mainlines. If you insert code which needs to exit the (cont.)
routine (or reference any paragraph names in the mainline then you must check which mainline you are in. For (cont.)
example:
IF (MAINT-FUNCTION)
  GO TO AAM440-TEST-RETURN-CODE
ELSE
  GO TO AAL440-TEST-RETURN-CODE.
Also, since this logic will be inserted twice (once in each mainline) you must avoid coding any paragraph names, they (cont.)
would be duplicated. It might simplify your work to place your logic in a routine which is PERFORM'd from %REDNX. The (cont.)
PERFORM'd routine should be in the %SUBRTNM insertion point (%SUBRTNL for MODLOCAT).
If you code non-MAGEC I/O, set TWA-DB-RETURN-CODE.
###
Online Insertion Point
%RELES
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM740-RELEASE-EXCL-CONTROL
Description:
This logic is executed only for MAINT-FUNCTION's in the CONTINUATION-MODE, and only when the ERROR-FOUND condition has (cont.)
been set (usually by either MAGEC Automatic Editing or by your coding in %EDIT). It drops the Exclusive Control which (cont.)
was obtained in the read-for-update logic earlier (%RDUKY).
The default logic for %RELES calls the MAGEC I/O module using the RELES command. It then exits to the AAM750-TEST-RETURN-CODE routine.
Suggested Uses:
If you coded a non-MAGEC I/O in %RDUKY to read-for-update then you should probably code an appropriate Release of the Exclusive Control here, in %RELES.
Since the fact that %RELES is executed indicates that some type of error has been detected, you could update some sort of a log file here.
Cautions:
Be sure to exit to AAM750-TEST-RETURN-CODE. You may just fall through to the GO TO which is immediately following the %RELES insertion point.
###
Online Insertion Point
%REMARKS
Found in Model:
MODELMMP MODELWIN MODLOCAT
Location:
IDENTIFICATION DIVISION -- REMARKS SECTION
Description:
The text you code in the %REMARKS insertion point will be inserted in the front of the generated MMP in the REMARKS section. It is for comments only, it does not execute.
Suggested Uses:
Describe what this MMP does, omit the standard things which all MMP's do, that is documented in the *Application User's Guide* which is provided with MAGEC.
Cautions:
Don't get too wordy, it gets boring.
Put an asterisk (*) in column 7 so that your remarks will be compatible with all versions of Cobol, including the '85 standard and PC MAGEC.
###
Online Insertion Point
%SCHEMA
Found in Model:
MODELMMP MODELWIN
Location:
DATA DIVISION
Description:
The %SCHEMA insertion point is in the data division immediately before the WORKING-STORAGE SECTION.
Suggested Uses:
You can insert database SCHEMA coding here. For instance, for IDMS.
Cautions
Check the rules and restrictions for your DBMS regarding this coding.
###
Online Insertion Point
%SELECT
Found in Model:
MODELMMP MODLOCAT  MODELWIN
Location:
PROCEDURE DIVISION -- CA700-MOVE-TO-WORK-AREA
Description:
This logic is near the top of the CA700 routine. It is a handy place to intercept each record that was read to (cont.)
determine whether or not you want to show it on the LOC, SCN, or FND screen display. The CA700 routine is PERFORM'd (cont.)
from the Browse Mainline only. It formats a "print line" in WS-ITEM to be MOVE'd to a screen line for the (cont.)
browses.
A one-byte switch, PROCESS-INDICATOR, is used to control the subsequent processing. A value of P (the default) (cont.)
indicates that this record is to be processed, a value of B indicates that this record is to be bypassed, a value of E (cont.)
indicates that the program is to simulate End-Of-File (and not process this record).
Suggested Uses:
You might test for record type on a multi-record-type file to bypass the inappropriate records for this browse. You (cont.)
might also test for some other logical subdivision, such as Company code to bypass records for all companies other than (cont.)
the one to which this operator belongs. Remember that the "Logical Record" you are looking at is made up of the (cont.)
combined data from the Primary Data Class plus any other Data Classes read in the %JOIN routine plus any Derived Fields (cont.)
which you may have COMPUTE'd in %JOIN.
The SCAN-CTR is incremented just prior to your %SELECT logic. It tells how many records have been read so far to try to (cont.)
fill the screen lines (this transaction). CUMULATIVE-SCAN-CTR tells how many have been read since the first screen of (cont.)
this browse. On the first "page" these two will be the same.
The SCAN-CTR is compared to SCAN-LIMIT (VALUE'd at 1000) to determine if the program should continue reading or just (cont.)
send what has been found so far and ask the operator to press the ENTER key to continue. You could alter the contents (cont.)
of SCAN-LIMIT by simply MOVE'ing some other value to it here. You could even do so based on which operator was at the (cont.)
terminal or which terminal or which location, etc.
CUMULATIVE-SCAN-CTR is displayed to the screen after the last line of each browse display, do not mess with it! You (cont.)
may, however, alter SCAN-CTR to affect the comparison with SCAN-LIMIT (i.e. MOVE 1000 TO SCAN-CTR) in order to "force" (cont.)
the transaction to stop reading and send the screen. This may be preferrable to altering SCAN-LIMIT in a truly (cont.)
reentrant environment since SCAN-LIMIT is in WORKING-STORAGE.
Cautions:
Remember, this logic is used only in BROWS-FUNCTION's, do not refer to any screen fields except those in MSK652.
Be careful not to corrupt the value in LIN-CTR as it is the subscript used to indicate which line on the screen (or, if PF13 was hit, on the hardcopy page) was last used.
The WS-ITEM print line has not yet been built, do not try to test for values in it here. You can do that in %LOCMOV, if necessary.
###
Online Insertion Point
%SKEYBLD
Found in Model:
MODELMM  MODELWIN
Location:
PROCEDURE DIVISION -- CA800-BUILD-SKEY
Description:
This logic is PERFORM'd from the CA700-END paragraph for the BROWS-FUNCTION's. It is also PERFORM'd from the (cont.)
Maintenance mainline for the NXT function. The function of this routine is to construct the Master (Primary) key, in (cont.)
the format that an operator would enter it (including any slashes, etc.) from the record data and then to MOVE the (cont.)
results to the screen in SKEY (also to TWA-LAST-KEY).
This is done to simulate an operator's entry of the full key when using the cursor selection features of BROWS-FUNCTION's or the forward or backward reading of NXT functions.
The default code for %SKEYBLD is the entire routine, including the CA800-BUILD-SKEY and CA899-EXIT paragraph names.
Suggested Uses:
In the unlikely event that you need to entirely replace the CA800 routine's logic you would use this insertion point.
To make more minor alterations to the output of the CA800 routine you might consider using the %SNDSCRN insertion point (cont.)
to intercept the screen just before it is sent. An example of some of the types of "minor" alterations you may want to (cont.)
make is adding a standard prefix or suffix for the Browse functions' cursor selection feature.
Cautions:
The logic of the CA800 routine (the default code) is somewhat complex and is based upon the definition of the Master (cont.)
key (xxxK1) for your MMP's Primary Data Class. It handles multi-component keys, mixed upper and lower case alphabetics (cont.)
within the key value, and mixed data representations (binary, packed, zoned decimal, signed, unsigned, alphanumeric). (cont.)
You may want to think twice before replacing your own routine for it.
The output of this routine is MOVE'd to both SKEY and TWA-LAST-KEY.
The input to this routine comes from the Cobol data-name you specified in the KYF file definition for the Primary Data Class' Master key (xxxK1)
###
Online Insertion Point
%SNDSCRN
Found in Model:
MODELMMP  MODELWIN
Location:
PROCEDURE DIVISION -- AA800-SEND-SCREEN
Description:
This logic is executed just before the MMP exits, returning to MAGECCP. Most of the time the MMP is exiting to allow (cont.)
MAGECCP to send the screen and then terminate the task, sometimes it may be exiting with a command in TWA-NONTP-REQUEST (cont.)
to invoke (fetch) another function (program).
There is no default logic for %SNDSCRN, if you do not provide any customization coding then it will simply be a comment.
Suggested Uses:
This is a handy place to intercept the screen just prior to its being sent back to the operator. You might wish to put (cont.)
some finishing touches on it, like blanking out a field if its value is zero, or setting the highlight (or color) (cont.)
attribute if its value is higher (or lower) than a certain level, and so forth.
You may wish to "massage" the SKEY value set by the cursor select feature (in CA800-BUILD-SKEY) on a BROWS-FUNCTION. For example, you might want to add some prefix or suffix to the key.
This logic is executed both for MAINT-FUNCTION's and for BROWS-FUNCTION's
Cautions:

next: insert06.md.txt