**Do this:** Cursor select the "Last Name" field and press PF18. **Do this:** Change the Heading value to "Name" and press enter. The heading for any field may be blanks (no heading) or it may be any character string. It need not be the same number (cont.) of characters as the detail line display for that field, it may be shorter or longer. If you set or alter a heading to (cont.) be longer than it was as originally generated you may also need to alter the size of the FILLER following that detail (cont.) item for alignment. This is to prevent having the heading literal overlap the heading for the next (left-to-right) (cont.) field. You can specify multi-line headings, as well (for fields appearing on the first line of detail, only). To make a (cont.) heading multi-line, simply use the semicolon character (;) as a "new line" character. For example, a heading specified (cont.) as: Date Employee; Fired would appear on the report, and on the report painter display screen, as: Date Employee Fired **Note:** When a Cobol ,programmer lays out a report, it is common for him/her to define FILLER fields before or after (cont.) each data display field in order to provide visual separation and make the report easier to read. MAGEC's report (cont.) generator is no different. The spaces between the data fields are actually FILLER's generated for separation. The size (cont.) of each FILLER is a minimum of the size specified on the Batch Program Header screen (Figure 01) in the NUMBER OF (cont.) SPACES BETWEEN FIELDS parameter; however, it may be larger in order to allow room for the preceding field's heading (cont.) when the heading is longer than the field. You can cursor-select these FILLER's just as you cursor-select any other (cont.) field in the report. You could, for example, point the cursor at the filler space between first and last name, press (cont.) PF18 (select for change), then change the size of the FILLER to PIC X(1). That would move the first and last names (cont.) closer together, which might produce a better looking report. ``` ** RPTDEF 600B M A G E C BATCH PROGRAM GENERATOR REPORT DEFINITION SCREEN LINE: 01 - 05 COLS: 001 - 080 RPT: MBP600B - VACATION REPORT 1...5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80 Hire Date Last Name First Name MM/DD/YY XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX ----- Vacation ----- ----- Sick Days ----- ----- Comp Days ----- Earned Taken Earned Taken Earned Taken ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- 1...5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80 (PF KEYS) --FIELD: 18=CHG 19=DEL 20=ADD 21=MOVE 16=CUT/COPY 10=SORT-KEYS --LINE: 4=DUP 5=ERASE 6=MOVE 13=DELETE 14=INSERT 24=NON-DISPL-FIELDS 12=GO TO BCHPGM ** ``` **Note:** The tutorial directs you to do several steps. This diagram depicts the screen as it should appear before the (cont.) first step, the familiar pop-up of field specifications will appear for each field you select for change usng PF18. (cont.) Though the pop-ups are not shown here, you have seen similar ones int he preceding tasks. Figure 26 — Report Display with Captions # Generate and Execute the Batch Report Program Now it is time to generate the program and execute it. **Do this:** Press PF15 to exit MAGEC's online environment. If you are doing the project on a PC: **Do this:** At the DOS prompt enter the command: MBPCREAT 600B. The program should be generated, compiled, and linked without fatal errors. **Do this:** At the DOS prompt enter the command: EXEC MBP600B. Your report will be produced as a file named \MAGEC\MBP600B.OUT, unless you have modified the .BAT file named EXEC.BAT in the \MAGEC\JCL directory to route the output (SYS007) elsewhere. If you are doing the project on a mainframe: **Do this:** Submit the MBPCREAT jobstream with the control card set to generate "600B". The program should be generated, compiled, and linked with no fatal errors. **Do this:** Submit the MBP600EX jobstream (it might need customization for your shop). Your report should be in the JES or POWER queue as would be the printed output from any ordinary Cobol program. ``` ** RPTDEF 600B Data UPDATED on Database M A G E C BATCH PROGRAM GENERATOR REPORT DEFINITION SCREEN LINE: 01 - 05 COLS: 001 - 080 RPT: MBP600B - VACATION REPORT 1...5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80 Hire Date Name MM/DD/YY XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX ----- Vacation ----- ----- Sick Days ----- ----- Comp Days ----- Earned Taken Earned Taken Earned Taken ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- ZZ,ZZZ.99- 1...5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80 (PF KEYS) --FIELD: 18=CHG 19=DEL 20=ADD 21=MOVE 16=CUT/COPY 10=SORT-KEYS --LINE: 4=DUP 5=ERASE 6=MOVE 13=DELETE 14=INSERT 24=NON-DISPL-FIELDS 12=GO TO BCHPGM ** ``` Figure 27 — Headings for "Name" Fields Altered Now you have created, generated, and executed a MAGEC Batch Report Program (MBP). The report produced when you execute (cont.) the program should look approximately like the one shown in Figure 28.1, .2, and .3. The program reads two database files, extracts data from them, constructs a sort file, sorts the records, and prints the report. The automatic program generator can handle up to 9 levels of sort keys, control breaks, totals, counts, averages, (cont.) multi-line detail, multi-line headings. It can be used to generate reports which print on complex pre-printed forms up (cont.) to 256 columns wide and up to 999 lines long. Customization of the program can be accomplished using standard Cobol and the customization methods proivided with (cont.) MAGEC. Through customization, there is literally no limit to what can be done other than the limitations of Cobol (cont.) itself. ``` **MBP600B VACATION REPORT PAGE 1 DATE 09/15/92 TIME 17:37 Hire Date Name -------------------------------------------------------------------------------- 02/29/88 LLOYD BOBBIE ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 150.00- 67,890.00 3.50 12.75 .00 .00 01/01/88 Newguy Added ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 15.00 20.00 2.00 1.00 .00 .00 01/01/88 Programmer Demo ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 150.00 200.00 2.00 1.00 .00 .00 12/31/87 Houdini Harry ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 14.50 2.25 124.50 3.00 2.00- .00 12/31/87 Man Super ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken .00 99.00 1.00 .00 8.00 19.00 12/31/87 The Magician Merlin ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 22.00 2.00 4.00 3.00 .00 .00 02/25/87 Geller Benny ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 25.00 10.00 .00 .00 200.00 50.00 02/25/87 Geller Joe ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken 25.00 10.00 50.00 20.00 100.00 50.00** ``` ``` **MBP600B VACATION REPORT PAGE 2 DATE 09/15/92 TIME 17:37 Hire Date Name -------------------------------------------------------------------------------- 02/25/87 GreenGiant Jolly ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken .00 9,999.00 .00 .00 2.00 .00 12/28/67 Copperfield David ------ Vacation ------ ------ Sick Days ------ ------ Comp Days ------ Earned Taken Earned Taken Earned Taken .00 99.00 100.00 .00 88.00 99.00** ``` ``` **MBP600B VACATION REPORT PAGE 3 DATE 09/15/92 TIME 17:37 Hire Date Name -------------------------------------------------------------------------------- ++++TOTAL: ++GRAND TOTAL=MBP600B (COUNT= 10) 101.50 78,331.25 287.00 40.75 396.00 218.00** ``` Figure 28 — Vacation Report Totals # Appendix A -- Deleting Sample Report Program ## If Sample Report is Already Done If someone else at your installation has already done the sample report project in this book, you will have to delete (cont.) all his work before you do the project, so that you can start fresh. You must be logged on to MAGEC to proceed with the (cont.) steps below. Enter RPTDEL 600B Press ENTER The report format will be displayed. Press PF5 To delete everything for that report. # Appendix B -- Edit Type Codes ## Automatic Editing When you define your report using RPTDEF, or when you modify it after having allowed the auto-paint feature to generate (cont.) it for you, you can specify to MAGEC that you desire automatic editing to be done to report fields. You do this by (cont.) specifying, for each field, an edit type code. These same edit type codes are also specified in the dictionary definitions for data items (DIT's). When you use the (cont.) auto-paint feature (for online screens) or the automatic report program generation MAGEC sets the screen or report (cont.) editing formats based upon the edit type codes found in the DIT definitions. You can override them in the MSKDEF or (cont.) RPTDEF functions if you need to. There are three general categories of edit types: AlphaNumeric Numeric Dates The Cobol copy book for a mask or the detail line definition for a report will contain appropriate Cobol edit patterns (cont.) (i.e.. ZZZ.99-) based on the edit type. You might refer to the chapter "Analysis of the Generated MMP" (in the (cont.) *Programmer's Reference Guide*) for more detail. For numeric fields there is also a specification as to how many digits left of the decimal point and right of the decimal point are allowed. One of the alphanumeric types is "T", that means table lookup validation. Operator entries (at online screens) will be (cont.) validated by looking them up in a MAGEC lookup table. You can define lookup tables and the valid entries in those (cont.) tables. Refer to the MAGEC "Database Administration" chapter for further details about lookup (cont.) tables. ## Table of Edit Types AlphaNumeric Edit Types: X Miscellaneous fields, any characters will be accepted. Example: company name, comments. b Same as X. A Alphabetic (A-Z and blank) characters only. Example: person's name, city name. U Uppercase. Any characters will be accepted as valid, lower-case alphabetics will be converted to uppercase by MAGEC. T Table lookup. Same as U plus MAGEC will validate entry against a lookup table. W Where to display a description from a lookup table. Used in conjunction with a T field. MAGEC moves the description from the found entry in the table to a W field. P Pattern edited alphanumeric field. Numeric Edit Types: N Numeric, MAGEC will pad with leading zeros. S Numeric, MAGEC will suppress leading zeros. = Same as S, plus trailing minus sign. Z Same as S, plus comma insertion. - Same as Z, plus trailing minus sign. $ Same as Z, plus floating dollar sign. # Pattern edited numeric field. Next: https://magec.com/DOC/markdown/battut06.md.txt