---
title: "insert_main"
original_file: "insert_main"
generated: "2026-06-12 10:24:19"
---
#
Online Insertion Points
## Online Insertion Point Cross Reference
| Insertion Point Name | Maintenance | Browse | Remarks
| New Trans Mode | Continuation Mode | New Trans | Continuation
| ADD | CHG | DEL | SEE | ADD | CHG | DEL | NXT | DUP | LOC | SCN | FND | LOC | SCN | FND
| ADDINIT | | | | | X | | | | X | | | | | | | Only if no error found
ADDIT | | | | | X | | | | X | | | | | | | Only if no error found
BLNKSCR | X | | | | | | | | | | | | | | | Also if Invalid Key or NOT-FOUND
CALC | | | | | X | X | | | X | | | | | | |
COMP | X | X | X | X | | | | | | | | | | | | Only if REC-FOUND
DATADEF | | | | | | | | | | | | | | | | Linkage Section
DELEDIT | | | | | | | X | | | | | | | | |
DELET | | | | | | | X | | |
| | | | | | Only if no error found
EDIT | | | | | X | X | | | X | | | | | | |
EDIT2 | | | | | X | X | | | X | | | | | | | If no error found in %EDIT
FUNCT | | | | | | | | | | | | | | | | Linkage Section - 88 levels
GOBACK | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
GOODADD | | | | | X | | | | X | | | | | | | If ADDIT is successful
GOODCHG | | | | | | X | | | | | | | | | | If UPDAT is successful
GOODDEL | | | | | | | X | | | | | | | | | If DELET is successful
INIT | X | X | X | X | X | X | X | X | X | | | | | | |
INITATB | X | X | X | X | X | X | X | X | X | | | | | | |
JOIN | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
LITERAL | | | | | | | | | | | | | | | | Working-Storage Section
LOCINIT | | | | | | | | | | X | X | X | X | X | X |
LOCKY | | | | | | | | | | X | X | X | | | |
LOCLITS | | | | | | | | | | X | X | X | X | X | X | Obsolete
LOCMOV | | | | | | | | | | X | X | X | X | X | X |
LOCVARS | | | | | | | | | | X | X | X | X | X | X | Obsolete
NKLOC | | | | | | | | | | X | X | X | X | X | X |
NORMKEY | X | X | X | X | X | X | X | X | X | | | | | | | Only if no error found in key
PFKEYL | | | | | | | | | | X | X | X | X | X | X |
PRKEYM | X | X | X | X | X | X | X | X | X | | | | | | |
PREINIT | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
RDUKY | | | | | | X | X | | | | | | | | |
REDKY | X | X | X | X | | | | | | | | | | | |
REDLE | | | | | | | | | | X | X | X | | | |
REDNX | | | | | | | | X | | X | X | X | X | X | X |
RELES | | | | | X | X | X | X | X | | | | | | | Only if error found
REMARKS | | | | | | | | | | | | | | | | Identification Division - Remarks
SELECT | | | | | | | | | | X | X | X | X | X | X |
SKEYBLD | | | | | | | | X | | X | X | X | X | X | X |
SNDSCRN | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
SPOOL | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | If PF13 hit
SCHEMA | | | | | | | | | | | | | | | | Before Working-Storage
SUBRTNL | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | Only when PERFORM'd
SUBRTNM | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | Only when PERFORM'd
UPDAT | | | | | | X | | | | | | | | | | Only if no error found
UPDERR | | | | | X | X | X | | X | | | | | | | Only if error found
USRAREA | | | | | | | | | | | | | | | | Linkage Section - 01 levels
VARSTOR | | | | | | | | | | | | | | | | Linkage Section - Variable Storage
| ADD | CHG | DEL | SEE | ADD | CHG | DEL | NXT | DUP | LOC | SCN | FND | LOC | SCN | FND
Figure 1
Refer to the ["Insertion Points"](/DOC/magref_main.htm#MAGREF009001) reference table for a compact list.
###
Online Insertion Point
%ADDINIT
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB600-BUILD-REC
Description:
Only used for ADD functions. This logic will be used to initialize the Record's Elements just before the individual (cont.)
Data Items are MOVE'd from the screen to the Elements. The default logic will just MOVE SPACES to the Elements. NOTE: (cont.)
it moves SPACES to all the Elements in TWA-DB-DATA, both from the primary and from joined Data (cont.)
Classes.
Suggested Uses:
Initializing numeric Data Items in the Elements to zero or to some other value. Setting default values into selected (cont.)
database fields which will NOT be MOVE'd to otherwise; i.e. they are not used as a Source/Target for any of the screen (cont.)
fields.
You may use this insertion point to set the "Date & Time Added" into the record, if you desire.
You may wish to override the default logic by moving SPACES (or other initialization value) to only the primary Data Class's Elements.
Cautions:
This logic will only be done for an ADD function; usually this means xxxADD or xxxDUP, unless you have added other ADD functions through customization in the %FUNCT insertion point.
If you MOVE a value to a Data Item which *is* specified as a Source/Target for a screen field; it will be overlaid when the generated MOVE's are done, immediately below in the BB600-BUILD-REC logic.
Do not attempt to MOVE to the Audit-Stamp. Anything you move there will be overlaid by the MAGEC I/O module since it handles all Audit-Stamp maintenance.
Your custom coding will replace the default MOVE SPACES. If you want the Element(s) initialized to SPACES first, you must code it in your logic.
###
Online Insertion Point
%ADDIT
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- AAM710-ADD-TO-DATABASE
Description:
This is the logic used to add a record to the Primary Data Class (file). The default logic CALL's the MAGEC I/O module. The command used when calling the MAGEC I/O module is: "ADDIT".
Suggested Uses:
When you add customization for %ADDIT MAGEC presents you with Proforma code which resembles the default logic. You may (cont.)
modify or add to it as needed. You can also entirely replace the Proforma by overkeying it. This enables you to code (cont.)
the necessary commands to access a file directly instead of using the MAGEC I/O module.
You could code the database commands for a non-MAGEC file.
You could add code to update a control record just before the add to the Primary file.
You could access a control record to determine the next available key (such as P.O. number, Invoice number, etc.) so as to assign the key for the record you are about to add.
Cautions:
If you want to do something after the add is completed, this is not the best place to do it. The %GOODADD insertion (cont.)
point is a better place since the MMP will test for a good return code before going to %GOODADD.
If you do other I/O before the add, be sure to save and restore TWA-DB-REQUEST (in TWA-DB-REQ-SAV) and TWA-ELT-LIST if you "step on" them.
Be sure not to "step on" the Elements (in TWA-DB-DATA) for the Primary Data Class before they are added to the file.
Be sure the file is open and authorized for adds.
###
Online Insertion Point
%BLNKSCR
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB100-BLANK-SCREEN
Description:
Logic inserted at the very end of the "blank screen" routine, after all the standard generated MOVE's of ALL '_' to all (cont.)
screen variables. This is executed on the "NEW-TRANSACTION" phase of the xxxADD function and also whenever the "INVALID (cont.)
KEY FORMAT" message is displayed.
Suggested Uses:
You could initialize selected screen fields to some value other than underscores, if you wish.
You could move values to the screen based on the key value the operator entered. For instance, if the key value in SKEY (cont.)
is a Customer Number, you might read the Customer file to get the Name and Address, then move them to the screen. (cont.)
Actually, the read might have been done in the %NORMKEY insertion point as a custom key edit.
You could test for an edit failure in the key normalization (IF SCOMPLE = E) and move your own message to the screen to help the operator correct the error.
Cautions:
This logic is only executed in the NEW-TRANSACTION phase of the xxxADD function (and on INVALID KEY). If you want (cont.)
something to be done at other times also, you should probably place the logic in a PERFORM'd routine (in %SUBRTNM) and (cont.)
then PERFORM it from here as well as from anywhere else it may be desired (such as %CALC and %COMP).
This logic may, of course, not reference any screen fields in MSK652 (the Browse Mask) since it is executed only for Maint functions.
###
Online Insertion Point
%CALC
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB610-MOVE-SCREEN-TO-DB
Description:
Logic inserted at the very end of the BB600-BUILD-REC routine which MOVE's data from the screen to the database (cont.)
Element(s). This logic will be after all the generated MOVE's from the screen fields to the record fields, but before (cont.)
the MOVE of NORMALIZED-KEY to the record key and before the business rule processing.
BB600-BUILD-REC is executed for all database updating functions, typically xxxADD, xxxCHG, xxxDUP. It is executed only (cont.)
in the CONTINUATION-MODE, not in the NEW-TRANSACTION-MODE -- and only if there were no fatal errors flagged in the (cont.)
editing (NOT ERROR-FOUND).
Suggested Uses:
You can override any of the generated MOVE's here.
You can move to database fields which are not the Source/Target for any screen field.
You can do calculations or conversions to store computed values, instead of "raw" screen data, on the file. For (cont.)
example, converting a date to Julian (or binary) using a conversion subroutine to save file space. There is such a date (cont.)
conversion subroutine, named MAGDATE, available with MAGEC.
You can override the value in NORMALIZED-KEY which will be moved into the record's key. NORMALIZED-KEY is moved in (cont.)
order to prevent the possibility of your adding records without setting the key value. In some cases the value in (cont.)
NORMALIZED-KEY may not be what you want as the key, especially on an ADD-FUNCTION where you may wish to automatically (cont.)
assign part or all of the key. You can bypass the MOVE of NORMALIZED-KEY by branching around it to the business rule (cont.)
logic; to do so you should GO TO BB680-DATA-RULES.
Cautions:
On an ADD function, the data in the Element's fields will be unreliable unless you have initialized it in %ADDINIT. (cont.)
This is not a good place to do I/O. If you do you will have to be careful not to "step on" the TWA-DB-REQUEST area (or, (cont.)
at least, save and restore it). Of course, you should also be careful not to corrupt the data just MOVE'd into the (cont.)
Element area.
If you want to update another file, such as a control record, you would be better off doing so in the %GOODADD and (cont.)
%GOODCHG insertion points, which will be executed only if the update I/O completes successfully.
Remember, %CALC logic will NOT be executed for any of the Browse functions (xxxLOC, xxxSCN, xxxFND). *Do not* GO TO (cont.)
BB699-EXIT unless you intend to bypass the MOVE of the record key coded just behind %CALC and also bypass the business (cont.)
rule processing.
###
Online Insertion Point
%COMP
Found in Model:
MODELMMP MODELWIN
Location:
PROCEDURE DIVISION -- BB200-FILL-SCREEN
Description:
This logic is inserted at the end of BB200-FILL-SCREEN. It is inserted after all of the generated MOVE's from the database fields to the screen, just before BB299-EXIT.
This code is executed in NEW-TRANSACTION-MODE of Maint functions to MOVE data to the screen for display. It is not (cont.)
executed in the CONTINUATION-MODE of any function, unless you PERFORM it in customization code of your (cont.)
own.
Suggested Uses:
You can MOVE literals or COMPUTE'd values to the screen here.
You can "translate" codes from the file into more readable descriptions and move them to the screen, if you wish.
You can alter screen field 3270 Attributes based on the data being displayed; especially useful when MAGEC's Extended Color support and 7-Color terminals are being used.
You can MOVE data or messages to the last three lines of the screen (SERRMSG), increasing the usable display capacity of the screen.
Cautions:
Data displayed in SERRMSG is Display-Only. If MAGEC needs to place error messages or other notifications there, your data will be overlaid.
This logic is executed only for Maint functions, you may not reference screen fields in MSK652, the Browse Mask.
If you are moving to a numeric screen field you should:
1) MOVE (or COMPUTE) into the "numeric equivalent" field, named S_____-N.
* -AND-*
2) MOVE to the "edit pattern" field, named S_____-ED. This will maintain the standard set by MAGEC in its generated MOVE's and will ensure agreement.
You should check numeric database fields (IF NUMERIC . . .) before trying to MOVE them if you are not (cont.)
sure of their validity. The generated MOVE's will do that if you have specified the VERIFY option.
###
Online Insertion Point
%DATADEF
Found in Model:
MODELMMP MODELWIN MODLOCAT
Location:
LINKAGE SECTION -- TWA-DB-DATA
Description:
This insertion point is immediately after the generated data definitions for the Elements specified in the Screen (cont.)
Header definition (SHDxxx screen). The Element definitions for any Logically Joined data will be automatically inserted (cont.)
next: insert02.md.txt