You could test for special conditions and force (or suppress) a control break.
The sorted logical record is available to you at this point. This insertion point is before the accumulation into the (cont.)
detail level accumulators and before the detail print line (WS-DETAIL-LINE) has been built.
Cautions:
The control break logic varies from program to program depending on the number of control breaks and sort fields (cont.)
specified. If you "hard-code" some logic based on a certain number of control breaks, then change the specs to result (cont.)
in a different number of breaks or sort fields, you could have a problem. Refer to the discussion about the insertion (cont.)
point %ACCUMS, also.
###
Batch Insertion Point
%BRKPRT
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- DC200-BREAK-PRINT
Description:
This logic is near the top of the routine which is PERFORM'ed at each control break (if ACCUM-PRINT-SW for this level = (cont.)
Y) to print the total line WS-TOTAL-LINE and, if requested, the average line (WS-AVRAG-LINE). The "total heading line" (cont.)
(WS-TOT-HDG-LINE) has not yet been built.
Suggested Uses:
You could override the entire break total printing routine by coding your own logic and GO'ing to DC299-EXIT.
You can dynamically control forced page breaks before or after each break by setting ACCUM-HOF-BEFORE and ACCUM-HOF-AFTER to Y or N, based on any criteria your desire.
Cautions:
This routine is PERFORM'ed for each level of break. The subscript, THIS-LVL, determines which break level is being (cont.)
processed. If you corrupt the value in THIS-LVL results will be unpredictable (or predictably (cont.)
wrong!).
If you wish to exit this routine you must GO TO DC299-EXIT. It is a very good idea to study the standard generated code before attempting to customize it.
###
Batch Insertion Point
%DATADEF
Found in Model:
MODELRPT
Location:
WORKING-STORAGE -- DB-DATA-AREA
Description:
This code is inserted immediately behind the generated includes (-MAGECINC's) for the program's primary and secondary Elements.
Suggested Uses:
You can code additional data definitions here. These may consist of more -MAGECINC statements or of standard Cobol definitions.
This is a good place to define any non-database (non-file) data, sometimes called "derived data". You could define (cont.)
items here which will be filled in via calculations you will provide in the %JOIN insertion point. This allows you to (cont.)
logically join non-file data to create a logical record. Data fields you have defined here could be referenced as the (cont.)
Source field for a report field (in RPTDEF).
Cautions:
If you define numeric fields in %DATADEF, be sure that they are always initialized with valid numeric data in %JOIN (or (cont.)
elsewhere). If the VERIFY option is off and you leave bad data in a numeric field which is referenced as a Source (cont.)
field, you will abend with a "data exception".
###
Batch Insertion Point
%EOJ
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- ZZ900-EOJ
Description:
This logic is inserted immediately before the GOBACK in ZZ999-GOBACK.
Suggested Uses:
This is a place where you can insert your own special end of job processing. You may need to close some files you have added. You may wish to DISPLAY or print special end of job messages.
Cautions:
The print file may have been closed in the %RPTEND logic.
You must exit the program using a GOBACK, not a STOP RUN, since your program is actually running as a subroutine to the (cont.)
MAGEC batch I/O module (and possibly another database I/O module, as well). When your program executes a GOBACK control (cont.)
returns to the I/O module(s) so that they can close files and clean house. This is especially important when your (cont.)
program is accessing an IMS/DL1 database or a Datacom/DB database as well as standard VSAM files.
###
Batch Insertion Point
%FILEFD
Found in Model:
MODELRPT
Location:
DATA DIVISION -- below PRINT-REC
Description:
This insertion point is in the FILE SECTION, just below the definition of the print file.
Suggested Uses:
You could add definitions for additional files here. You could also redefine the PRINT-REC here if necessary.
Cautions:
The length of the PRINT-REC is variable, depending on the specifications for this program (on the BCHPGM screen).
###
Batch Insertion Point
%FILES
Found in Model:
MODELRPT
Location:
ENVIRONMENT DIVISION -- FILE-CONTROL
Description:
This insertion point is immediately after the generated SELECT statements for the SORT-FILE and PRINTR file.
Suggested Uses:
You could code SELECT statements for your own additional files here.
Cautions:
Do not forget to code the OPEN (in %INITWS or %PREINIT) and the CLOSE (in %EOJ) for your files.
###
Batch Insertion Point
%HDGPRT
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- DA200-HDG
Description:
This logic is performed at all page breaks. It prints the report headings.
Suggested Uses:
You could code your own heading routine to be used in lieu of the default logic which MAGEC will insert here if you do (cont.)
not provide customization for %HDGPRT. This will enable you to produce reports with headings vastly different from the (cont.)
standard headings MAGEC generates.
You could catalogue a standard heading routine on the MAGEC library which produces headings in compliance with your own (cont.)
installation's standards. You could then merely code a -MAGECINC statement in %HDGPRT to include it.
Cautions:
To exit this routine you must GO TO DA299-EXIT.
###
Batch Insertion Point
%INITWS
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- AA000-BEGIN
Description:
This insertion point is near the top of the program logic, just after the standard generated initialization logic. It is the last point before the SORT begins.
Suggested Uses:
You could initialize any variables you have added to the program (in %DATADEF or %ACCUMS).
You could override the settings which control break printing and so forth. These are set in generated code just before the %INITWS insertion point.
You could actually code your own SORT, overriding the generated SORT statement, and then GO TO ZZ900-EOJ.
Cautions:
You are not yet in the SORT, so the SORT-FILE is not yet open.
You have not yet executed the CALL to MAGDBMS with the '*READ' command. This command tells MAGDBMS (the I/O module) (cont.)
that this program does not intend to update any of the files which are accessed, therefore, the I/O module simply opens (cont.)
the files "read-only". If you access a file via MAGDBMS in the %INITWS insertion point, MAGDBMS will open the file for (cont.)
update (the default), unless you first code a CALL using the '*READ' command. It is okay to CALL MAGDBMS with '*READ' (cont.)
multiple times.
###
Batch Insertion Point
%JOIN
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- BB100-LOGICAL-JOIN
Description:
This logic is PERFORM'ed after each read of the primary data. It is where you logically join data from other files or (cont.)
other databases or from calculations. The result of the logical join process is this program's "logical (cont.)
record".
Suggested Uses:
If you use the Automatic Logical Join facilities in creating your program (via BCHPGM, etc.) online, then there will (cont.)
likely already be customization coding generated for you in %JOIN. This generated customization coding will read up-to (cont.)
fifteen (15) secondary files, as specified on your BCHPGM screen definition.
You can read any type of additional file(s) here, MAGEC files or non-MAGEC files.
You can fill in non-file (derived) fields which you have defined in the %DATADEF insertion point.
Cautions:
Do not "clobber" the data which is in DB-DATA-AREA which has been filled in via the preceding reads. If you have defined numeric fields in %DATADEF, be sure to set them to valid numeric values here.
To exit this routine you must GO TO BB900-RETURN or just allow the logic to "fall thru" to BB900-RETURN.
###
Batch Insertion Point
%MGLOCKY
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- BA102-START-BROWSE
Description:
This logic starts (positions) the reading into the primary file. The default logic will CALL the I/O module (MAGDBMS) (cont.)
using the LOCKY command with a key value of LOW-VALUES. This starts reading at the beginning of the (cont.)
file.
Suggested Uses:
You could override the default logic to start reading somewhere other than the beginning of the file by setting a starting key value other than LOW-VALUES into DB-KEY-VALUE.
You may wish to do some special routine just before (or just after) positioning into the file -- for instance, OPEN one of your own files.
After the LOCKY command is processed the key value of the first record to be read is returned in DB-KEY-VALUE, you might want to interrogate it.
Cautions:
If you bypass the LOCKY CALL altogether, the subsequent REDLE and REDNX CALLs will not work correctly -- you should override them with customization also.
###
Batch Insertion Point
%MGREDLE
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- BA102-START-BROWSE
Description:
This insertion point immediately follows the %MGLOCKY insertion point. The default logic for %MGREDLE will CALL the I/O (cont.)
module (MAGDBMS) with the REDLE command to read the record which you just positioned to via the LOCKY (cont.)
command.
Suggested Uses:
You may wish to read a non-MAGEC file, rather than use the standard generated code to CALL MAGDBMS.
You may wish to do something special for the first record read, you could do that here.
Cautions:
It is a good practice to test the return code (IF REC-FOUND) and to handle an error condition if one arises. You could (cont.)
simply GO TO BZ190-END to terminate the input procedure of the sort and proceed to the output procedure. Some sort (cont.)
software does not handle "zero records sorted" very well, therefore you might want to issue a message and terminate the (cont.)
program.
If you do not choose to terminate the program in this insertion point then you should GO TO BA112-GET-JOINED-DATA, or (cont.)
just fall thru to the generated statement below %MGREDLE which will GO TO that routine.
If you read a non-MAGEC file, you should be sure to set the values in DB-REQUEST-AREA accordingly so that subsequent (cont.)
program logic operates correctly. Particularly, be sure to set DB-RETURN-CODE correctly.
###
Batch Insertion Point
%MGREDNX
Found in Model:
MODELRPT
Location:
PROCEDURE DIVISION -- BA110-READ-NEXT
Description:
This insertion point is used to sequentially read through the primary file. The default code will CALL the I/O module (MAGDBMS) using the REDNX command.
Suggested Uses:
You could override the standard MAGEC reads with your own reads of a non-MAGEC file.
You might wish to place code here to bypass certain records. An example of that would be when reading a file which has (cont.)
multiple record types, you may wish to process only one type. You can bypass records by coding GO TO (cont.)
BA110-READ-NEXT.
next: insert08.md.txt