Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM755-GOODCHG
Description:
This logic will be executed only on a xxxCHG function and only after a successful database update to the Primary Data (cont.)
Class. If the return code from the I/O indicates an error then the %UPDERR logic will be executed (cont.)
instead.
The default logic simply MOVE's the UPDATED-MSG to the screen field, SCOMPL, then fetches to the SEE function to re-display the updated data.
Suggested Uses:
You may want to update another record/file after a successful update of the Primary Data Class, perhaps some of the files which were Logically Joined in the %JOIN routines.
The Primary Data Class' data is still available to you in the TWA-DB-DATA area, you may reference it.
This would be a good place to "post" to a control record.
You might wish to transfer to another screen, function, or program after a successful update. You can do so by coding:
MOVE 'xxxxxx' TO SFUNCT.
MOVE FTH-FUNCT TO TWA-NONTP-REQUEST.
GO TO AA900-GOBACK.
where xxxxxx is the desired "next function" you wish to transfer to.
An example of this might be a case where, after an update to an Invoice on the Invoice file (function IVCCHG, perhaps), (cont.)
you wish to transfer immediately to the Customer display screen to show the effect on the Customer's status. Assume (cont.)
that the function code is CUSSEE, and that the Customer number from the Invoice record is to be used as a key to read (cont.)
the Customer file with.
In the IVCCHG program (MMP), in the insertion point %GOODCHG, you could code:
MOVE 'CUSSEE' TO SFUNCT.
MOVE FTH-FUNCT TO TO TWA-NONTP-REQUEST.
MOVE IVC01-CUSTOMER-NO TO SKEY.
GO TO AA900-GOBACK.
Cautions:
To exit this routine be sure you GO TO AA800-SEND-SCREEN or to AA900-GOBACK to avoid falling through to the irrelevant logic below.
###
Online Insertion Point
%GOODDEL
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM757-GOODDEL
Description:
This logic will be executed only in xxxDEL functions and only after a successful delete of the Primary Data. If a bad (cont.)
return code is sensed (the delete failed) then the %UPDERR logic will be executed instead.
The default logic simply MOVE's the DELETED-MSG to the screen field, SCOMPL.
Suggested Uses:
You may want to update a control record, or any other file, after a successful delete.
You may want to transfer to another function, screen, or program. For example, after the deletion of an Invoice from (cont.)
the Invoice file you might want to automatically present the Customer display (function CUSSEE, perhaps) to show the (cont.)
effect on the Customer's status. To do that you might code:
MOVE 'CUSSEE' TO SFUNCT.
MOVE FTH-FUNCT TO TWA-NONTP-REQUEST.
MOVE ------- TO SKEY. (customer number)
GO TO AA900-GOBACK.
Cautions:
To exit this routine you should GO TO AA800-SEND-SCREEN or AA900-GOBACK to avoid falling through to the irrelevant coding below.
###
Online Insertion Point
%INIT
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION BA150-MAINT-INIT
Description:
This logic is executed in the initialization for all MAINT-FUNCTIONs (xxxADD, xxxCHG, xxxSEE, etc.) very early in (cont.)
execution of the program. VARIABLE-STORAGE is always set to LOW-VALUES just before the %INIT code is (cont.)
executed.
Suggested Uses:
You can initialize any data and work fields in VARIABLE-STORAGE (or elsewhere) here. This is useful when you have (cont.)
defined some of your own custom variables in %VARSTOR or in %DATADEF, particularly if they are COMP-3 and need to be (cont.)
set to ZERO to avoid Data Exception errors. In some environments it is permissible to MOVE to WORKING-STORAGE items (cont.)
also. Be careful of doing this in any environment in which your program might be "swapped" in and out, such as WESTI. (cont.)
It is best to reserve WORKING-STORAGE for constants, that is why the insertion point in WORKING-STORAGE is named (cont.)
%LITERAL.
Cautions:
Do not reference any screen fields except for the standard MAGEC fields (SFUNCT, SKEY, SCOMPL, and SERRMSG) here since (cont.)
this logic is executed before the MMP has made sure that the proper Mask format is in effect; it is possible that the (cont.)
screen is still formatted with some other MMP's Mask.
If you wish to check whether the Mask area is properly formatted, you may do so by coding:
IF TWA-MSK-ID = THIS-PGMS-MSK THEN .........
###
Online Insertion Point
%INITATB
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BA200-INIT-ATTRIBUTES
BA210-MAINT-SCREEN
Description:
This logic will be executed only for Maint functions (xxxADD, xxxSEE, etc.) and not for Browse functions. It is (cont.)
inserted at the very end of the Attribute Initialization routine, immediately before BA299-EXIT.
Suggested Uses:
You can override the default Attribute values which are set in BA210-MAINT-SCREEN, perhaps based on the Function Code or even on the Operator ID (TWA-EMP-NO), or any other criteria.
All the valid 3270 attribute codes are defined in the MMP in an included "copy book" for your convenience. They are (cont.)
named ATxxxxxx (xxxxxx is the six-character code, exactly like you specify online in MSKDEF). They are documented in (cont.)
your Developer's Reference Summary and in the appendices of your Developer's Tutorials.
You can also alter the contents of any screen fields here. This is handy for setting a variable screen heading based on the Function Code or any other criteria.
Cautions:
Do not reference Data Items from the file here since the I/O has not yet been done.
To exit the routine be sure to GO TO BA299-EXIT, or just fall through to it.
Do not reference fields in the Browse screen (MSK652) since this routine is only executed for Maint functions, and after the Maint Mask has been formatted (read in).
###
Online Insertion Point
%JOIN
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- JA100-LOGICAL-JOIN
Description:
This logic is executed after each of the standard READ's of the Primary Data Class. It is used to READ other files or (cont.)
to do calculations of "derived fields" which are to be Logically Joined to the Primary data. The result is that the MMP (cont.)
has a "Logical Record" made up of data from one or more physical files (and records) plus, possibly, some computed (cont.)
fields.
This logic is executed for both Maint and Browse functions.
Suggested Uses:
If you use the Automatic Screen Painting and Logical Join then the READ's for your "Secondary" files will be automatically generated here. You may modify them, if you wish.
You may code your own READ's here, or your own calculations for "derived fields". An example might be computing the (cont.)
gross pay by multiplying hours times rate, where hours and rate are in the file data and gross pay is not. More complex (cont.)
algorithms are, of course, possible. This allows you to treat gross pay (a field you have defined in %VARSTOR) as if it (cont.)
were an ordinary Data Item, it may even be the Source/Target for a screen field.
You need not worry about saving and restoring the TWA-DB-REQUEST area, the MMP does it before PERFORM'ing the JA100-LOGICAL-JOIN routine.
Cautions:
If you must reference screen fields then you will have to be certain that the Mask is formatted as you expect. This (cont.)
logic is executed for both Maint and Browse functions. Therefore, it is possible that either the Maint Mask or the (cont.)
Browse Mask (MSK652) is formatted.
To be sure, you can code:
IF (MAINT-FUNCTION)
-or-
IF (BROWS-FUNCTION)
before trying to access screen fields.
To exit the routine:
GO TO JA900-RETURN
-- not JA999-EXIT!
###
Online Insertion Point
%LITERAL
Found in Model:
MODELMMP MODELWIN
Location:
WORKING-STORAGE -- 01 CUSTOM-ALGORITHM-LITERALS
Description:
This insertion point is at the end of WORKING-STORAGE, it allows you to add your own custom literals and constants to the MMP.
Any valid Data Division definitions are allowed. You may use any Cobol level numbers (except 77) and any clauses (VALUE, OCCURS DEPENDING, etc.).
This area is not initialized by the MMP unless you code some MOVE's to it, it is intended to be constant data.
Suggested Uses:
You may define literals, constants, message text, and so forth here. There is no particular size restriction on this (cont.)
area, except that WORKING-STORAGE is physically a part of your program and your environment may impose a size limit for (cont.)
programs.
Cautions:
In some environments (notably WESTI) you must not MOVE to data fields in WORKING-STORAGE since your MMP might be (cont.)
"rolled in and out" at any time and these areas might revert to their initial values unexpectedly.
It is good "form" to avoid MOVE'ing to WORKING-STORAGE in all but exceptional cases, regardless of environment.
If you do not code the VALUE clause the contents of any fields you define here will be unpredictable.
Data in WORKING-STORAGE is not saved and passed from execution to execution, it is intended to be constant data which never is altered.
###
Online Insertion Point
%LOCINIT
Found in Model:
MODELMMP MODLOCAT MODELWIN
Location:
PROCEDURE DIVISION -- BA100-INIT-STORAGE & BA105-LOCAT-INIT
Description:
This logic will be executed only for Browse (xxxLOC, xxxSCN, and xxxFND) functions. It will be executed very early in the processing to initailize VARIABLE-STORAGE and other work fields.
All the standard initializations are done just prior to the %LOCINIT coding; therefore, you may use %LOCINIT to override or supplement the standard logic.
There is no default logic for %LOCINIT, if you do not provide any custom logic then only the standard initialization logic will be done.
Suggested Uses:
You can initialize any work fields you may have added to the %VARSTOR or %LOCVARS definitions.
You can alter the value of UPPERCASE-SW from Y to N to tell the xxxSCN and xxxFND functions that you do not wish for (cont.)
upper and lowercase alphabetics to be compared as equal in its searches. A value of Y causes them to be compared as (cont.)
equal (i.e. "Alan" will match "ALAN" or "alan", etc.).
Cautions:
This logic must never reference screen fields in the Maint Mask (THIS-PGMS-MASK), only those in the COMMON-LOC-MSK (MSK652).
Since this logic is executed prior to the logic which checks that the screen is formatted with the COMMON-LOC-MSK, it (cont.)
is possible that the screen format is neither THIS-PGMS-MSK nor MSK652. You really should not refer to screen fields (cont.)
other than the four standard MAGEC fields which are on all Masks. They are SFUNCT, SKEY, SCOMPL, and (cont.)
SERRMSG.
###
Online Insertion Point
%LOCKY
Found in Model:
MODELMMP MODLOCAT MODELWIN
Location:
PROCEDURE DIVISION -- AAL410-SET-STARTING-POSITION
Description:
This logic is executed only for Browse functions. It is executed in the NEW-TRANSACTION-MODE to "position" into the Primary file (using a generic key value in NORMALIZED-KEY).
The default logic calls the MAGEC I/O module to access the file. It uses the FSTAT command to test the file's status (cont.)
(open or closed), then uses the LOCKY command to set the position for subsequent reads.
Suggested Uses:
You might wish to code the logic to access a non-MAGEC type of file (or database). Or you might wish to make minor modifications to the default logic which does the calls.
When you are adding custom coding for %LOCKY you will be presented with a Proforma which resembles the default logic (cont.)
very closely. You may overkey all, or any portion, of it to create whatever coding you desire. The purpose for the (cont.)
Proforma is simply to reduce your keystrokes since most of the time you will probably want to make only minor (cont.)
alterations to the default logic.
You may wish to alter the key value in NORMALIZED-KEY (by forcing a certain prefix, perhaps) just before the LOCKY is (cont.)
done. If you did this based on Operator ID or Location you could effectively restrict users' access on Browses. The (cont.)
fields TWA-EMP-NO and TWA-LOCATION tell you who is logged on and where.
Cautions:
If you code your own non-MAGEC I/O you might want to set the TWA-DB-RETURN-CODE to indicate whether your I/O was (cont.)
successful or not. That will allow the remainder of the logic of the MMP to flow naturally, as if the I/O were a (cont.)
standard MAGEC I/O.
To exit this routine either GO TO AAL440-TEST-RETURN-CODE or just fall through to the "GO TO" which is immediately following the %LOCKY insertion point.
###
Online Insertion Point
%LOCLITS
Found in Model:
next: insert04.md.txt