in %DATADEF in the form of -MAGECINC statements. A Cobol 03-level item (TWA-DB-DATA) is the group item which includes (cont.)
all these Element definitions below it.
Suggested Uses:
You can add more data definitions for the MMP here. They may be -MAGECINC statements or straight Cobol coding. Since (cont.)
this area follows TWA-DB-DATA, which is a Cobol level 03, you must avoid using Cobol level 02 and 01 (cont.)
here.
TWA-DB-DATA is initialized to SPACES on ADD functions (unless you have coded logic in %ADDINIT to do otherwise). If you (cont.)
insert an 03 level here then all definitions below will NOT be part of TWA-DB-DATA and will NOT be (cont.)
initialized.
You may define areas here which are NOT read into; one common reason to do so would be to define Data Items which are (cont.)
to be COMPUTED or otherwise derived in the Logical Join process. This allows Logically Joining of non-database (cont.)
data.
Cautions:
Be careful not to use Cobol level 02 or 01 here. Also, the Cobol VALUE clause is illegal here.
This area is NOT initialized in BA100-INIT-STORAGE unless you code customization in %INIT and %LOCINIT to do so.
This area is within the 12K portion of the TWA which is saved and restored to the TWA-file. Defining a very large area (cont.)
here will possibly "push" other data beyond the 12K boundary, causing it NOT to be saved and restored. In that case you (cont.)
could move some of the areas defined here down to the %VARSTOR insertion point since this data usually does not need to (cont.)
be saved.
It is usually important that everything down to, not including, VARIABLE-STORAGE be within the 12K boundary.
###
Online Insertion Point
%DELEDIT
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB400-EDIT-FOR-DELETE
Description:
The logic in %DELEDIT will be inserted after the paragraph BB400-EDIT-FOR-DELETE and before the paragraph BB499-EXIT. It will make up the entire edit-for-delete routine.
Since there is no default logic for %DELEDIT, unless you provide a %DELEDIT routine the edit-for-delete will effectively be "null".
This logic will be performed before doing the delete in the xxxDEL function. If you set FATAL-ERR = E here, the delete will not be done, an error message will be issued instead.
Logic will be executed only in CONTINUATION-MODE for DEL functions.
Suggested Uses:
You might want to read other files to check for the existence of subordinate or related records before allowing the (cont.)
deletion to occur. For example, be sure there are no invoices on file for a customer before deleting the customer (cont.)
master record.
You might want to be sure that certain values in the record to be deleted are zero before allowing a deletion. For example, customer balance.
To set the ERROR-FOUND condition with an error message you can MOVE an error number to ERROR-NUMBER and then PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT.
You might want to require that some PF key be used to do a delete. You could test:
IF (NOT TWA-MSK-PFx-HIT) ..
. and set an error condition.
Cautions:
Do not corrupt the TWA-DB-REQ-SAV area; that is where the TWA-DB-REQUEST area has been automatically saved just prior to executing the edit-for-delete routine.
If you are requiring some PF key to allow a delete, you should inform the operator. You could do that easily by (cont.)
MOVE'ing a message TO ENTER-TO-DEL-MSG, overlaying the default message "Press ENTER to Delete" with something like (cont.)
"Press PFx to Delete". This should be done in the %REDKY insertion point, after the I/O module call and after the (cont.)
PERFORM of JA100-LOGICAL-JOIN.
Avoid using PF1, PF15, PF13 or other PF keys already being used by MAGEC or your MMP.
###
Online Insertion Point
%DELET
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM730-DELETE-FROM-DATABASE
Description:
This logic will be used to accomplish the actual delete of the Primary Data Class' record. The default logic will call (cont.)
to the MAGEC I/O module using the "DELET" command. This logic will be executed only for xxxDEL functions and only if (cont.)
the ERROR-FOUND condition is not set by the edit-for-delete coding (see %DELEDIT).
Suggested Uses:
You could override the default coding completely to do an I/O command directly, bypassing the MAGEC I/O module. It might even be for a DBMS not directly supported by MAGEC.
A Proforma routine is presented when you are adding new %DELET customization coding, it is very similar to the default (cont.)
logic. You might wish to simply add a few lines of coding to the Proforma; perhaps to update a control record before (cont.)
actually doing the delete.
Cautions:
Be sure not to clobber TWA-DB-REQUEST, or be sure to save it in TWA-DB-REQ-SAV and then restore it if you need to do any other I/O in your customization.
If you wish to exit from this routine, remember that you must GO TO AAM750-TEST-RETURN-CODE, which is where the delete logic normally exits to.
###
Online Insertion Point
%EDIT
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB500-SCREEN-EDIT
Description:
Logic to validate data in any screen fields and set error number(s) as appropriate. This will be executed on database (cont.)
updating functions (xxxADD, xxxCHG, xxxDUP). Virtually any type of editing and validation may be done here, including (cont.)
any type and amount of I/O.
If you set the ERROR-FOUND condition here, then the MMP will not do the database update. Instead, it will return to the MAGEC Control Program to have the error message(s) sent.
There is no default logic for %EDIT.
Suggested Uses:
You can do any type of screen data validation here. You can do any type of "cross-field" validations or those involving I/O.
Remember, the Automatic Editing can handle most of the mundane chores for you; such as date validation, numeric (cont.)
editing, and table lookups. You should take advantage of the Automatic Editing to its fullest -- then code any (cont.)
additional edits here, as %EDIT customization. You may refer to Data Items (fields) in the "before image" record(s) (cont.)
(except on xxxADD functions) to compare them to screen data, if you wish. This enables you to determine which items (cont.)
were changed by the operator, or to do crossfield edits using Data Items which were not displayed to the (cont.)
screen.
You can set either fatal error or warning messages. Fatal errors prevent any updating to the database, warnings do not. (cont.)
To set a fatal error condition you PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT; to set a warning message you (cont.)
PERFORM CA400-LOAD-WARNING-TO-TBL THRU CA499-EXIT.
Cautions:
To exit the BB500-SCREEN-EDIT routine you must GO TO BB599-EXIT. This bypasses both the %EDIT and %EDIT2 coding.
The editing logic you insert in %EDIT is* in addition to* whatever Automatic Editing has already done, it is a (cont.)
possibility that some error conditions have already been flagged by Automatic Editing prior to the Cobol MMP even (cont.)
receiving control.
You should adhere to the convention of setting the ERROR-FOUND condition (by PERFORM'ing CA100-LOAD-ERR-CODE-TBL THRU (cont.)
CA199-EXIT) and setting the error number (by MOVE'ing it to ERROR-NUMBER) and indicating the screen field in error (by (cont.)
MOVE'ing E to S_____E) -- as is shown in the Proforma when you are adding %EDIT logic.
###
Online Insertion Point
%EDIT2
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB500-SCREEN-EDIT
Description:
This logic is similar to the %EDIT logic, except that it is for edits which might be "costly" (in terms of I/O, (cont.)
usually). These edits are preceded by a test for the ERROR-FOUND condition. If any errors have already been found, then (cont.)
the %EDIT2 logic simply bypasses further checks and GO's to BB599-EXIT.
The value of using %EDIT2 is that it avoids unnecessarily consuming system resources by ceasing to look for more errors once a fatal error is detected.
This logic will be after BB500-SCREEN-EDIT and before BB599-EXIT. There is no default logic for %EDIT2.
Suggested Uses:
Any edits which involve heavy I/O burden. Any edits which would be illogical to do after other errors have been found.
It is permissible to update a file(s) here based on the fact that errors were (or were not) found above. This might be useful for gathering statistics regarding error rates, etc.
You need not worry about saving and restoring TWA-DB-REQUEST since the MMP's mainline logic saves it before PERFORM'ing BB500-SCREEN-EDIT THRU BB599-EXIT.
Editing and validation routines should adhere to the same conventions here as in %EDIT regarding setting the error number and setting the ERROR-FOUND condition, etc.
Cautions:
The %EDIT2 insertion point should be used instead of %EDIT only for those edits which will indeed be very costly to do (cont.)
unnecessarily. The disadvantage is that the operator may correct all the errors shown on the screen and then press (cont.)
ENTER only to be shown another error which was not detected earlier.
The normal logic, unless you have overridden it, will test for ERROR-FOUND in order to bypass further editing once an (cont.)
error is detected. You must be aware of this when planning the sequence of your edits. The first one to detect an error (cont.)
will bypass all following edits. For instance, you might wish to test for the most likely errors (cont.)
first.
Remember, all the %EDIT logic will be inserted before the %EDIT2 logic.
You should review the discussion for the %EDIT insertion point as well as this one.
###
Online Insertion Point
%FUNCT
Found in Model:
MODELMMP MODELWIN
Location:
LINKAGE-SECTION -- VARIABLE-STORAGE
Description:
These are the "88-level" definitions of the various function codes for this MMP. They are inserted immediately (cont.)
following the 6-byte field named TEST-FUNCT. The logic of the MMP is very heavily controlled by these (cont.)
definitions.
This defines which functions are valid for this MMP, which are "Maintenance functions" and which are "Browse (cont.)
functions", and which are ADD, CHG, etc. These 88-level condition names are refered to throughout the (cont.)
MMP.
Default coding defines the standard nine functions, xxxADD, xxxCHG, xxxDEL, xxxSEE, xxxNXT, xxxDUP, xxxSCN, xxxFND, and xxxLOC.
Suggested Uses:
You can add your own custom functions to an MMP. Any six-character code which can be keyed into a 3270 screen will be (cont.)
valid, so long as it does not contain any blanks and it is not already defined for another MMP.
You might want two similar inquiry displays for different departments, one showing all the data and one showing only (cont.)
"non-sensitive" fields (or records). An easy and efficient way to do that would be to allow the xxxSEE function to show (cont.)
all data and define a new function (perhaps xxxINQ) which has different security requirements and uses the same screen (cont.)
and MMP, but "hides" the sensitive data by setting non-display 3270 attributes for them. You could set the attributes (cont.)
in %INITATB based on which function was being done.
You could also defeat a function that you absolutely do not want (such as the xxxDEL function) by setting the value of DEL-FUNCTION to blanks from 'DEL' (for instance).
Cautions:
All the standard 88-level condition names must be present in order for the MMP to compile clean. You may add some more of your own, but do not delete the standard ones.
The Automatic Editing routine in MAGEC's Control Program looks at the function codes to determine whether or not to do (cont.)
the editing. Essentially, it assumes that xxxADD, xxxCHG, and xxxDUP functions will update the database and thus should (cont.)
receive Automatic Editing. Other functions are assumed to NOT require Automatic Editing unless you have specifically (cont.)
told MAGEC that they do (on the FCDxxx screen). If you want to add a new updating function (similar to xxxCHG) which (cont.)
might be xxxUPD (for example), you will need to specify Auto Editing on the FCD definition (when you do FCDADD) as well (cont.)
as specifying it as another CHG-FUNCTION here in %FUNCT.
###
Online Insertion Point
%GOBACK
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AA900-GOBACK
Description:
Absolutely the last opportunity to insert code in the logical flow of the online processes for all functions, both MAINT-FUNCTIONS and BROWS-FUNCTIONS.
Suggested Uses:
This may be a good place to insert the TERMINATE for a PCB if you are using IMS
Cautions:
This is the logical end of the processing for all functions. If you desire to reference screen data you should first interrogate which mask is initialized.
###
Online Insertion Point
%GOODADD
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM753-GOODADD
Description:
This logic will be executed only on the xxxADD function after the return code has been checked to ensure that the I/O (cont.)
for an "add" completed successfully. If the add did not complete successfully then the %UPDERR logic will be executed (cont.)
instead of this logic.
The default logic for %GOODADD merely moves the DATA ADDED message to SCOMPL and fetches to the SEE function to re-display the added data.
Suggested Uses:
You may wish to issue a different message from the standard DATA ADDED message. You may wish to automatically transfer (cont.)
to another screen and function after a successful add. You would use the FTH-FUNCT command to do that. For example, (cont.)
after a successful CUSADD (Customer add) you might want the Invoice add (IVCADD) screen to immediately appear. You (cont.)
could do that by coding:
MOVE 'IVCADD' TO SFUNCT.
MOVE FTH-FUNCT TO TWA-NONTP-REQUEST.
GO TO AA900-GOBACK.
You may wish to update some other files after a successful add, perhaps a control record or a transaction log file.
Cautions:
Remember, this logic is executed only if the "Primary" add was successful.
Depending on the Access Method, you may or may not be able to re-read the record just added using the RDUID command. RDUKY should work for any Access Method, however.
This logic should end with GO TO AA800-SEND-SCREEN (or optionally, GO TO AA900-GOBACK) to avoid falling thru irrelevant logic below.
###
Online Insertion Point
%GOODCHG
next: insert03.md.txt