Introduction

Who Should Read This Guide

This guide is written primarily for use by those persons who will be using the MAGEC software to develop and maintain online and batch applications.

Copies of this guide should be distributed to:

  • Application Developers
  • Database Administrators
  • System Programmers
  • Auditors
  • This book is not intended to replace the Online Documentation but to augment it. This book will introduce the reader to the basic process used to generate batch applications. In order to demonstrate the tasks most effectively, it uses an actual new development project which the reader can do as he/she is following the tutorial instructions.

    Supplemental Reading

    This guide is written assuming that the reader is familiar with the overall MAGEC philosophy. It presumes that you understand how the "standard set of nine" functions work and that you are familiar with the standard screen formats of MAGEC. You may wish to read through this book first to gain an initial understanding of the application development process. While doing the sample project it would also be useful for you to have some other MAGEC Programmer's Reference Guide chapters handy:

  • "Database Administration"
  • "Security System"
  • "Offline Utilities"
  • "Librarian"
  • "Documentation"
  • These are not required but will help you gain a more complete understanding of the MAGEC environment.

    This tutorial may be used as an introductory course without requiring you to have read the other chapters listed above since brief explanations are included for all features necessary to develop and to test the sample application.

    How to Use This Tutorial

    Throughout this book you will find explicit commands telling you exactly what to do to develop the sample application. You will also notice quite a bit of explanation and background information to help you to understand what is happening.

    In order to allow you to "skim" over the background information the first pass through the book we have inserted "markers" pointing to the explicit commands. They look like this:

         DO THIS:
    The commands will be inside a box like this.
       

    You may wish to go through the tutorial actually doing the project as you read, then re-read it for more complete explanation. This technique seems to facilitate faster learning for most people.


    Getting Started

    Log On to MAGEC.

    There is a special logon ID provided for the MAGEC installer. If you have not been assigned a logon ID and password, you can use it for doing these tutorials. The ID is: employee number 18, password ALEE.

         DO THIS:
    Use the TS01 TransID to enter MAGEC, log on as usual.
       

    Deleting Previous Student's Work

    You might not be the first one in your shop to do this project; therefore, you might need to delete the previous student's work before you begin. To do so:

         DO THIS:
    Follow instructions in Appendix A of this tutorial, if necessary.
       

    The Sample Report

    The sample report we will create in this project will access the same two Data Classes as we used for the sample online application. They are:

    1) VAC vacation, sick time, and comp time data

    2) SIF security information file

    These are already defined to the MAGEC dictionary. For a better understanding of how to define data to the dictionary you might refer to the "Database Administration" chapter or "Data Definition" Tutorial in your MAGEC manuals.

    The primary Data Class for this report will be VAC, the SIF data will be logically joined to it.

    NOTE:

    The report will list data for employees sorted in sequence by Date Hired, most recent dates first (descending sequence), and by Employee Name within Date Hired. It will show the employee's name, date hired, and vacation days earned and taken, sick days earned and taken, and comp days earned and taken. We have limited the report width so that it will easily fit on 80-column wide paper. This enables you to do the tutorial on a standard desktop computer as well as on your mainframe computer and to get identical results.


    Developing a Batch Application

    Batch Program Header

    To develop a batch report program, first enter the "header" information into the dictionary.

         DO THIS:
    Key in the command:  BCHPGM 600B, press ENTER.
       

    REPORT ID is the 8-character identifier which will appear on the top line, left corner of every page usually, the program name.

    REPORT TITLE is the 30-character heading which will appear centered on the top line of every page of the report.

    PROGRAMMER NAME is the name of the person responsible, embedded blanks should be avoided (replaced with dots?) for compatibility with other compilers, librarians, etc.

    PRIMARY DATA CLASS is the 3-character data class name of the data to be accessed first, others may be joined to it in the logical join process. There is no limit to how many data classes you can access in a program.

    KEY NAME is the 5-character name of the key to be used to access the primary data class.

    PRIMARY DATA CLASS ELEMENTS is the list of 5-character element names of the elements to be accessed from the primary data class.

    Additional Elements Desired is the list of names of elements from other data classes to be accessed.

    MAXIMUM CHARACTERS PER LINE is the report width in characters, defaults to 132, may be up to 256.

    MAXIMUM LINES PER PAGE is the page length in lines, defaults to 55, may be up to 999.

    DETAIL LINE SPACING defaults to 1 (single spaced), may be up to 9.

    NUMBER OF SPACES BETWEEN FIELDS is the width of the gap between report "columns", defaults to 2, may be up to 255.

    NUMBER OF SPACES IN LEFT MARGIN is the "indentation", defaults to 1, may be up to 255; entering "CEN" causes MAGEC to calculate the indentation to center the report on the page.

    CHANGE lower-case to UPPER-CASE is the flag that tells MAGEC that your printer cannot handle lower-case alphabetics, MAGEC will automatically translate them to upper-case. Default is Y (yes).

    VERIFY OPTION is the option that tells MAGEC how to handle non-numeric values encountered in the incoming file/database records in data items which are supposed to be numeric. The default, VERIFY, will set the value to zero and issue an error message and continue processing. The ACCEPT option will set the value to zero without an error message, and continue. The NO option will simply do nothing, allowing the program to abend with a Data Exception condition.

    SUPPRESS DETAIL PRINTING is the option to suppress showing the detail lines on the report, thus creating a summary report. Default is no.

    
     BCHPGM 600B
    
    M A G E C
      BATCH PROGRAM GENERATOR
    MAGEC Batch Program 600B  - PROGRAM SPECIFICATIONS

      REPORT ID.:  REPORT TITLE:
      PROGRAMMER NAME:
      USE MODEL:
      PRIMARY DATA CLASS:  ******************************
      KEY NAME:  ******************************
      PRIMARY DATA CLASS ELEMENTS:
      Additional Elements Desired: _____ _____ _____ _____ _____
      (other data classes)  _____ _____ _____ _____ _____
      _____ _____ _____ _____ _____
      MAXIMUM CHARACTERS PER LINE: 132  MAXIMUM LINES PER PAGE: 055
      DETAIL LINE SPACING: 1  1 THRU 9
      NUMBER OF SPACES BETWEEN FIELDS: 002  HORIZONTAL SPACING VALUE
      NUMBER OF SPACES IN LEFT MARGIN: 001  NNN or "CEN" to center report
      CHANGE lower-case to UPPER-CASE: Y  Y=YES  N=NO
      VERIFY OPTION: VERIFY  VERIFY or ACCEPT or NO
      SUPPRESS DETAIL PRINTING: N  Y=YES  N=NO
    Press PF4 for browse (LOC) screen  Press PF13 for Hardcopy
    Press PF16 to Copy field to buffer  Press PF17 to Paste data from buffer
    Press PF2 for field-level HELP

    Figure 01 -- Batch Program Header Screen

         DO THIS:
    Fill in the screen as shown on facing page, press ENTER.
       

    Please note that we are specifying the program name as the REPORT ID. You should substitute your name for PROGRAMMER NAME.

    We are overriding some of the default values on the lower half of the screen:

    MAXIMUM CHARACTERS PER LINE = 80  

    CHANGE lower-case to UPPER-CASE = n  

    This assumes that your printer can handle lower-case characters, if not then you should leave the default "Y" in the CHANGE lower-case to UPPER-CASE option.

    When you press ENTER you will be taken to the data item (field) selection screen.

    NOTE:

    
     BCHPGM 600B
    
    M A G E C
      BATCH PROGRAM GENERATOR
    MAGEC Batch Program 600B  - PROGRAM SPECIFICATIONS

      REPORT ID.: mbp600b  REPORT TITLE: vacation report
      PROGRAMMER NAME: your.name
      USE MODEL: modelrpt
      PRIMARY DATA CLASS: vac  ******************************
      KEY NAME: vack1  ******************************
      PRIMARY DATA CLASS ELEMENTS: vac01
      Additional Elements Desired: sif01 _____ _____ _____ _____
      (other data classes)  _____ _____ _____ _____ _____
      _____ _____ _____ _____ _____
      MAXIMUM CHARACTERS PER LINE: 80  MAXIMUM LINES PER PAGE: 055
      DETAIL LINE SPACING: 1  1 THRU 9
      NUMBER OF SPACES BETWEEN FIELDS: 002  HORIZONTAL SPACING VALUE
      NUMBER OF SPACES IN LEFT MARGIN: 001  NNN or "CEN" to center report
      CHANGE lower-case to UPPER-CASE: n  Y=YES  N=NO
      VERIFY OPTION: VERIFY  VERIFY or ACCEPT or NO
      SUPPRESS DETAIL PRINTING: N  Y=YES  N=NO
    Press PF4 for browse (LOC) screen  Press PF13 for Hardcopy
    Press PF16 to Copy field to buffer  Press PF17 to Paste data from buffer
    Press PF2 for field-level HELP

    Figure 02 -- Report Specifications

    Field Selection

    The fields you select will be placed on the report with the first one being the leftmost column and subsequent fields added from left to right. You will have the chance to alter the order of fields using a "report painter" later on. MAGEC also will select the first three fields to be the sort fields. That is, they will be specified as the major, intermediate, and minor sort keys for the report. You can alter that using the report painter, as well. You can specify up to nine (9) sort fields. Each may be sorted on in either ascending or descending sequence. You may specify to take control breaks on any, all, or none of those sort fields. You can specify to force page breaks (head-of-form) either before, after or both before and after any of those control breaks.

    The fields you select will be flagged. The sequence you select them in will be shown under the heading "Selected".

    You could un-select an item by pressing PF4 with the cursor pointing to it, if you make an error, for instance.

    You could un-select all items and start over by pressing PF10.

    If you cursor-select a group item and press ENTER, a pop-up window will instruct you to press PF18 to automatically select all the elementary subordinate items or to press PF19 to select the single group item as one field. If you cursor-select a group item having its subordinate items selected and press PF4 (to un-select), a pop-up window will instruct you to press PF14 to un-select the selected elementary items subordinate to it.

    You can page forward or backward through the multi-page list using the PF8 and PF7 keys, respectively.

    Items which are part of the primary key for the data class are indicated as "Key". Elementary items which are components of the key field are numbered for your convenience and information. Items which describe the entire element (i.e. VAC01-ELEMENT) are flagged as "Elt".

    When you are done selecting, pressing PF6 tells MAGEC to go on to the next step in the process.

         DO THIS:
    Select the VAC01-DATE-HIRED by pointing to it with the cursor and pressing ENTER.
       

    
     BCHPG2 600B                           PF8=Forward / PF7=Backward / PF5=Top
    
      REPORT DEFINITION - FIELD SELECTION SCREEN
    Grp Key  CURSOR-SELECT Data Item  Ocr  Selected
      + +  T O P  O F  L I S T  + +
    Elt VAC01  04 VAC01-ELEMENT  X(00198)
    Grp Key  05 VAC01-KEY  X(00018)
      Key-1  07 VAC01-EMPNUM  9(09)
      Key-2  07 VAC01-FILLER  X(00009)
      _05 VAC01-DATE-HIRED  MM/DD/YY
      05 VAC01-EARNED-VACATION  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-VACATION  S9(05)V9(02) COMP-3
      05 VAC01-EARNED-SICK-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-SICK-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-EARNED-COMP-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-COMP-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-COMMENT  X(00050)  3X
    Elt SIF01  04 SIF01-ELEMENT  X(00264)
    Grp Key  05 SIF01-MASTER-KEY  X(00006)
    Grp Key  07 SIF01-LOVALU  X(00002)
      Key-1  09 SIF01-KEY-PREFIX  S9(04)  COMP

    ENTER = select item  PF4 = un-select item  PF6 = Auto-Draw report
    PF10 = un-select ALL items  PF3 = Escape to BCHPGM
      0 ITEMS HAVE BEEN SELECTED  VACATION REPORT

    Figure 03 -- Field Selection Screen

    Notice that the selected item is flagged.

    Also notice that the list is shown with a "top of list" marker to denote that you cannot page backwards from this point. There is also an "end of list" marker at the bottom of the list.

    If you page forward when you are at the bottom of the list you will "wrap around" to the top of the list again.

    If you needed to return to the Element Selection Screen (BCHPGM) you could just press PF3.

    Pressing PF8 pages forward, pressing PF7 pages backward.

         DO THIS:
    Press PF8 to page forward in the list.
       

    
     BCHPG2 600B                           PF8=Forward / PF7=Backward / PF5=Top
    
      REPORT DEFINITION - FIELD SELECTION SCREEN
    Grp Key  CURSOR-SELECT Data Item  Ocr  Selected
      + +  T O P  O F  L I S T  + +
    Elt VAC01  04 VAC01-ELEMENT  X(00198)
    Grp Key  05 VAC01-KEY  X(00018)
      Key-1  07 VAC01-EMPNUM  9(09)
      Key-2  07 VAC01-FILLER  X00009)
      05 VAC01-DATE-HIRED  MM/DD/YY ++ 01 ++
      05 VAC01-EARNED-VACATION  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-VACATION  S9(05)V9(02) COMP-3
      05 VAC01-EARNED-SICK-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-SICK-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-EARNED-COMP-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-COMP-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-COMMENT  X(00050)  3X
    Elt SIF01  04 SIF01-ELEMENT  X(00264)
    Grp Key 05 SIF01-MASTER-KEY  X(00006)
    Grp Key  07 SIF01-LOVALU  X(00002)
      Key-1  09 SIF01-KEY-PREFIX  S9(04)  COMP

    ENTER = select item  PF4 = un-select item  PF6 = Auto-Draw report
    PF10 = un-select ALL items  PF3 = Escape to BCHPGM
      1 ITEM HAVE BEEN SELECTED  VACATION REPORT

    Figure 04 -- Field Selection Shown

    You are now looking at the second page of the list of data items within the elements you will be accessing. Notice that the MAGEC dictionary definitions of items are very Cobol oriented. Anyone who is even casually acquainted with Cobol should have no difficulty in recognizing what they mean.

    These definitions, and the Cobol PICTURE's, are for the data items (DIT's) in the VAC and SIF database files. You will have an opportunity to specify different PICTURE's for their corresponding report detail fields if you wish.

         DO THIS:
    Select SIF01-LAST-NAME using the cursor and press the ENTER key.  When a pop-up
    
    window appears, press PF19 to select
    this group fields as single items, rather than selecting the elementary items below them.
    (see note below).    

         DO THIS:
    Select SIF01-FIRST-NAME using the cursor and press the ENTER key.  When a pop-up
    
    window appears, press PF19 to select
    this group fields as single items, rather than selecting the elementary items below them.
    (see note below).    

    NOTE:

    
     BCHPG2 600B 
    
      REPORT DEFINITION - FIELD SELECTION SCREEN
    Grp Key  CURSOR-SELECT Data Items  Ocr  Selected

    Grp Key  07 SIF01-EMPNO  X(00004)
      Key-2  09 SIF01-EMPNUM  S9(09)  COMP
    Grp  _05 SIF01-FIRST-NAME 
      07 SIF01-F-INIT 
      07 SIF01-FILLER 
    Grp  _05 SIF01-LAST-NAME 
      07 SIF01-L-INIT 
      07 SIF01-FILLER 
    Grp  05 SIF01-LAST-ON-DT 
      06 SIF01-LAST-ON-DT-YY 
      06 SIF01-LAST-ON-DT-MM 
      06 SIF01-LAST-ON-DT-DD 
    Grp  05 SIF01-LAST-ON-TM 
      07 SIF01-LAST-ON-TM-HH 
      07 SIF01-LAST-ON-TM-MM 
      07 SIF01-LAST-ON-TM-SS  X(00002)

    Figure 05 -- Field Selections on Second Page

    Figure 06 on the opposite page shows the FIELD SELECTION SCREEN after the name field selections are complete.

         DO THIS:
    Press PF7 to page back in the list.
       

    
     BCHPG2 600B                            PF8=Forward / PF7=Backward / PF5=Top 
    
      REPORT DEFINITION - FIELD SELECTION SCREEN
    Grp Key  CURSOR-SELECT Data Items  Ocr  Selected

    Grp Key  07 SIF01-EMPNO  X(00004)
      Key-2  09 SIF01-EMPNUM  S9(09)  COMP
    Grp  05 SIF01-FIRST-NAME  X(00015)  ++ 03 ++ 
      07 SIF01-F-INIT  X(00001) 
      07 SIF01-FILLER  X(00014) 
    Grp  05 SIF01-LAST-NAME  X(00025)  ++ 02 ++
      07 SIF01-L-INIT  X(00001) 
      07 SIF01-FILLER  X(00024) 
    Grp  05 SIF01-LAST-ON-DT  X(00006) 
      06 SIF01-LAST-ON-DT-YY  X(00002) 
      06 SIF01-LAST-ON-DT-MM  X(00002) 
      06 SIF01-LAST-ON-DT-DD  X(00002) 
    Grp  05 SIF01-LAST-ON-TM  X(00006) 
      07 SIF01-LAST-ON-TM-HH  X(00002) 
      07 SIF01-LAST-ON-TM-MM  X(00002) 
      07 SIF01-LAST-ON-TM-SS  X(00002)

    ENTER = select item  PF4 = un-select item  PF6 = Auto-Draw report
    PF10 = un-select ALL items  PF3 = Escape to BCHPGM
      3 ITEMS HAVE BEEN SELECTED  VACATION REPORT

    Figure 06 -- "Name" Fields Selected

    Pressing PF7 has paged backward one screen and returned to the TOP OF LIST. We are now ready to select the remaining fields to be shown on the report.

         DO THIS:
    Select the following fields in sequence by pointing to them with the cursor and pressing ENTER:
    

    VAC01-EARNED-VACATION
    VAC01-TAKEN-VACATION
    VAC01-EARNED-SICK-DAYS
    VAC01-TAKEN-SICK-DAYS
    VAC01-EARNED-COMP-DAYS
    VAC01-TAKEN-COMP-DAYS

    Turn to the next page in the manual.    

    
     BCHPG2 600B                           PF8=Forward / PF7=Backward / PF5=Top
    
      REPORT DEFINITION - FIELD SELECTION SCREEN
    Grp Key  CURSOR-SELECT Data Item  Ocr  Selected
      + +  T O P  O F  L I S T  + +
    Elt VAC01  04 VAC01-ELEMENT  X(00198)
    Grp Key  05 VAC01-KEY  X(00018)
      Key-1  07 VAC01-EMPNUM  9(09)
      Key-2  07 VAC01-FILLER  X00009)
      05 VAC01-DATE-HIRED  MM/DD/YY ++ 01 ++
      05 VAC01-EARNED-VACATION  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-VACATION  S9(05)V9(02) COMP-3
      05 VAC01-EARNED-SICK-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-SICK-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-EARNED-COMP-DAYS  S9(05)V9(02) COMP-3
      05 VAC01-TAKEN-COMP-DAYS  S9(05)V9(02) COMP-3

      05 VAC01-COMMENT  X(00050)  3X
    Elt SIF01  04 SIF01-ELEMENT  X(00264)
    Grp Key 05 SIF01-MASTER-KEY  X(00006)
    Grp Key  07 SIF01-LOVALU  X(00002)
      Key-1  09 SIF01-KEY-PREFIX  S9(04)  COMP

    ENTER = select item  PF4 = un-select item  PF6 = Auto-Draw report
    PF10 = un-select ALL items  PF3 = Escape to BCHPGM
      3 ITEMS HAVE BEEN SELECTED  VACATION REPORT

    Figure 07 -- Field Selections Shown

    Figure 08 on the opposite page shows the FIELD SELECTION SCREEN with the field selection task completed.

         DO THIS:
    Press PF6 to Auto-Draw report.
       

    
     BCHPG2 600B                            PF=Forward / PF7=Backward / PF5=Top 
    
      REPORT DEFINITION - FIELD SELECTION SCREEN
    Grp Key  CURSOR-SELECT Data Items  Ocr  Selected
      +  +  T O P  O F  L I S T  + + 
    Elt VACO1  04 VAC01-ELEMENT  X(00198)
    Grp Key  05 VAC01-KEY  X(00018)
      Key-1  07 VACO1-EMPNUM  9(09)
      Key-2  07 VACO1-SPACES  X(00009)
      05 VACO1-DATE-HIRED  MM/DD/YY  ++ 01 ++
      05 VACO1-EARNED-VACATION  S9(05)V9(02) COMP-3  ++ 04 ++
      05 VAC01-TAKEN-VACATION  S9(05)V9(02) COMP-3  ++ 05 ++
      05 VACO1-EARNED-SICK-DAYS  S9(05)V9(02) COMP-3  ++ 06 ++
      05 VACO1-TAKEN-SICK-DAYS  S9(05)V9(02) COMP-3  ++ 07 ++
      05 VACO1-EARNED-COMP-DAYS  S9(05)V9(02) COMP-3  ++ 08 ++
      05 VAC01-TAKEN-COMP-DAYS  S9(05)V9(02) COMP-3  ++ 09 ++ 
      05 VACO1-COMMENT  X(00050)  3X
    Elt SIF01  04 SIF01-ELEMENT  X(00264)
    Grp Key  05 SIF01-MASTER-KEY  X(00006) 
    Grp Key  07 SIF01-LOVALU  X(00002) 
    Grp Key-1  09 SIF01-KEY-PREFIX  S9(04)  COMP 

    ENTER = select item  PF4 = un-select item  PF6 = Auto-Draw report
    PF10 = un-select ALL items  PF3 = Escape to BCHPGM
      9 ITEMS HAVE BEEN SELECTED  VACATION REPORT

    Figure 08 -- Select Remaining Fields

    Logical Join

    This is the semi-automated Logical Join process. In the first development project, the one in which you developed an online application, you used the fully-automated process; in this project you are using the semi-automated process to develop a batch report program. The development of online applications currently supports both the semi-automated process and the fully-automated process; the development of batch programs supports only the semi-automated process as of this release of MAGEC.

    MAGEC is showing you the Cobol code which it will generate to access the SIF01 element. It was able to generate this much based upon what is defined in the dictionary. There is one thing more which is needed and which MAGEC was unable to determine automatically, what to use as a key value.

    It is asking you to build the key value in the field named SIF01-MASTER-KEY.

    Notice that near the bottom of the screen is a display which tells you which element(s) you are now joining (reading) and which element(s) you have already read. It is important, sometimes, to know what data is available to you at the time this code will be executed.

    The code you are shown, plus any code you key into it, will be stored in the dictionary as "customization code" which will be inserted into the generated program. You can access and modify this code at any time later as need arises. The various points in the generated program's logic at which you can insert code are called "insertion points". The insertion point where this logic will be inserted is named: %JOIN.

    You could display the %JOIN customization online via the command:

    ALGSEE 600B/JOIN  

    NOTE:

         DO THIS:
    Turn to the next page.
       

    
     BCHPG7 600B
    
      M A G E C
      Automatic Logical Join

     Enter Code to Build Key Value into SIF01-MASTER-KEY
      IF (NOT-FOUND)  GO TO BB900-RETURN.
      MOVE REDKY  TO DB-REQUEST-AREA.
      MOVE 'SIFK1'  TO DB-KEY-NAME.
      MOVE 'SIF01  ' TO DB-ELT-LIST.
    _






      MOVE SIF01-MASTER-KEY  TO DB-KEY-VALUE.
      CALL 'MAGDBMS' USING DB-REQUEST-AREA  SIF01-ELEMENT
      DB-ELT-LIST.
      IF (NOT-FOUND)  GO TO BB900-RETURN.

    LOGICAL JOIN RULES TO READ: SIF01
     AFTER: VAC01
      press PF10 to bypass to RPTDEF

    Figure 09 -- Logical Join Screen

    We are building a key by filling in the two component fields which make up SIF01-MASTER-KEY. They are a key prefix of zero, plus the employee number.

    We are, in effect, using the employee number to join these two data classes.

         DO THIS:
    Key in the two lines of code as shown on the facing page, press ENTER.
       

    The code being shown is a standard call to the MAGEC I/O module. You can refer to the "Database Administration" chapter of the manual for more information about database accessing.

    The logical join concept, plus the MAGEC element concept, give your programs a high degree of data independence. You programs actually process logical views of data rather than physical views.

    
     BCHPG7 600B
    
      M A G E C
      Automatic Logical Join

     Enter Code to Build Key Value into SIF01-MASTER-KEY
      IF (NOT-FOUND)  GO TO BB900-RETURN.
      MOVE REDKY  TO DB-REQUEST-AREA.
      MOVE 'SIFK1'  TO DB-KEY-NAME.
      MOVE 'SIF01  ' TO DB-ELT-LIST.
      move zero to sif01-key-prefix.
      move vac01-empnum to sif01-empnum.






      MOVE SIF01-MASTER-KEY  TO DB-KEY-VALUE.
      CALL 'MAGDBMS' USING DB-REQUEST-AREA  SIF01-ELEMENT
      DB-ELT-LIST.
      IF (NOT-FOUND)  GO TO BB900-RETURN.

    LOGICAL JOIN RULES TO READ: SIF01
     AFTER: VAC01
      press PF10 to bypass to RPTDEF

    Figure 10 -- Custom Join Coding

    The Report Painter

    Now that you have completed the logical join you are transferred to the "report painter" (RPTDEF) screen. This works much like the screen painter (MSKDEF) used when developing online applications.

    The automatic report generator builds the report from left to right and top to bottom based on your field selection list sequence. It will use the number of columns specified on the BCHPGM screen (80) and begin a new line when a line is filled.

    Figure 11, on the opposite page, shows the default results from the automatic report generator.

    Our report will be easier to read if all of the numeric fields are on the same line; so move the "Earned Vacation" field down to the second text line and make it the leftmost field on that line.

         DO THIS:
    Position the cursor to the Earned Vacation field and press PF21.
       

    
     RPTDEF 600B
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 03  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  Earned Vacation
     MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX  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 11 -- Selecting Field for Move

    Notice that the message at the top-left corner of Figure 12 shows that the field selection for MOVE was successful, while the SERRMSG portion of the screen (bottom three-lines) displays the PF key options to continue the move process. PF21 will abort the field move and redisplay the Report Definition; PF12 will abort the field move and return to the BCHPGM screen. PF17 will process the field move based on the cursor position.

         DO THIS:
    Move the cursor to the first column of the last text line displayed (not the bottom Ruler Line) and press PF17.
       

    NOTE:

    
     RPTDEF 600B                           ++ Field Selected for MOVE Function ++
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 03  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  Earned Vacation
     MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX  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











      21=ABORT FIELD MOVE
      12=GO TO BCHPGM  17=MOVE SELECTED FIELD

    Figure 12 -- Specifying Where to Move Field

    In Figure 13 the field and heading for Earned Vacation have been removed from the first text line of the report and added to the left end of the second detail line, with the pre-existing fields shifted to the right to make room for the Earned Vacation field display. Also notice that the field specifications for the field just moved are displayed at the bottom of the screen to allow any needed changes to the field definition.

    No changes are needed however for this move.

         DO THIS:
    Press Enter to complete Field Move.
       

    
     RPTDEF 600B
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 03  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 
     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
    --------------------------------------------------------------------------------
    FIELD NAME:  PRINT-EARNED-VACATION  PIC:  ZZ,ZZZ.99-
     DISPLAY: Y  BWZ: N TOTAL: Y  AVG: N  LGTH= 010
     SORT SEQUENCE: 0  DIR:  CTL BRK: N  HOF PRE-BRK: N  POST-BRK: N
    SOURCE/TARGET: VAC01-EARNED-VACATION  TYPE= -  SIG= 05  DEC= 02
      HEADING: Earned Vacation

      PATTERN:
    --------------------------------------------------------------------------------

    Figure 13 -- Field Definition of Moved Field

    Now let's build captions for the second line of detail by inserting a line.

         DO THIS:
    Position the cursor onto any field on the first detail line of the report (either heading or text) and press PF14. 
       

    NOTE:

    
     RPTDEF 600B                           Data UPDATED on Database
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 03  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 
     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 14 -- Inserting a Line

    The Report Painter has inserted a new line after the first text line and shifted the other text line down one line. Also, there is a field now defined for the new line with a text value of "--NEW---" displayed to designate the new field's position. Select the new field and make it part of the caption we are building.

         DO THIS:
    Position the cursor on the NEW field and press PF18.
       

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 04  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 
     --NEW---
     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: Whenever you add a field (PF20) or insert a line (PF14), MAGEC will generate a dummy field which looks like this. You can modify this generated field to make it a variable field or a heading field as you wish.


    Figure 15 -- Dummy Field Defines New Line

    Field Specification Window

    Figure 16 on the opposite page shows a field added with the new line inserted.

    A window appears displaying all of the specifications associated with that field. Let's review them.

    FIELD NAME is the name which will be generated for the print field in the Cobol program.

    PIC is the Cobol picture for this field in the print line.

    DISPLAY is a yes/no code specifying whether this field will appear on the printed report. Non-display fields are usable for calculations and sorting but do not show up in the print line.

    BWZ is the yes/no flag (for numeric fields only) which signifies BLANK WHEN ZERO (in the print line).

    TOTAL is a yes/no flag which indicates (for numeric fields only) whether to print a total for this field at control breaks.

    AVG is the yes/no flag which indicates (for numeric fields only) whether to print an average at control breaks.

    LGTH is displayed for your information only, it is derived from the Cobol PICTURE.

    SORT SEQUENCE indicates the sort level for this field. A "0" indicates this is not a sort field, A "1" through "9" indicates that this is a sort field and its sort level.

    DIR indicates (for sort fields only) the sort direction, A or D.

    CTL BRK is the yes/no flag indicating (for sort fields only) whether or not control breaks are to be triggered in the report when a change is sensed on this field.

    HOF PRE-BRK is a yes/no flag (for CTL BRK = Y fields only) indicating whether a "head-of-form" is to be generated prior to printing the control break totals for this field.

    POST-BRK is a yes/no flag (for CTL BRK = Y fields only) indicating whether a "head-of-form" is to be generated after printing the control break totals for this field.

    SOURCE/TARGET is the Cobol name of the database (file) field which is the source for this field in the report. An asterisk (*) indicates that a literal specified in HEADING is source.

    TYPE is the MAGEC Edit Type of the source/target field as defined in the dictionary. A type of "blank" is equivalent to "X".

    SIG (for numeric fields only) is the number of significant digits left of the decimal point (for the source field in database). For date fields, SIG is the number of digits in the year.

    DEC (for numeric fields) is the number of decimal places in the source field.

    HEADING is the literal which is to be printed as a column heading for this field. It is initially set to the PROMPT from the dictionary definition for the source field. A multi-line heading can be specified; the semicolon (;) character is used to separate the lines. For example: FIRST;NAME would appear on the report (and on the RPTDEF screen) as:
      FIRST
      NAME

    PATTERN is the edit pattern used when displaying this field, it is applicable only for Edit Type "P" and "#" fields.

         DO THIS:
    Turn to the next page in this book.
       

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 04  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 
     --NEW---
     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
    --------------------------------------------------------------------------------
    FIELD NAME: PRINT-002-002  PIC: X(00008)
     DISPLAY: Y  BWZ: N  TOTAL: N  AVG: N  LGTH=008
     SORT SEQUENCE: 0 DIR:  CTL BRK: N  HOF PRE-BRK: N  POST-BRK: N
     SOURCE/TARGET: *  TYPE= X  SIG= 00  DEC= 00
      HEADING: --NEW---

      PATTERN:
    --------------------------------------------------------------------------------

    NOTE:

    Figure 16 -- Report Field Specifications

    The new field is generated with a SOURCE/TARGET value of asterisk(*) so that the HEADING value will print as a literal. Any report display field with a SOURCE/TARGET of asterisk will display the HEADING value for the field value.

    The field name is generated based on the row and column where the field is added. The field picture clause and length are also generated to agree with the HEADING. All other field specifications are generated as defaults, but may be changed by you, the user.

         DO THIS:
    Change the PIC clause to X(00070) and enter the HEADING value as shown in Figure 17. Then, press ENTER.
       

    If you draw the headings slightly different from the example, they may not align perfectly over the detail fields below; in that case you may wish to correct the headings you have drawn. After you press ENTER, the report image will show the effect of your changes. If you wish to change it again, just position the cursor onto the field and press PF18 (select for change), correct the data, and press ENTER. You can do this over and over until you are satisfied with the results.

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 04  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 
     --NEW--
     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
    --------------------------------------------------------------------------------
    FIELD NAME: PRINT-002-002  PIC: X(00070)
     DISPLAY: Y  BWZ: N  TOTAL: N  AVG: N  LGTH= 070
     SORT SEQUENCE: 0  DIR:  CTL BRK: N  HOF PRE-BRK: N  POST-BRK: N
     SOURCE/TARGET: *  TYPE= X SIG= 00  DEC= 00
      HEADING:  ----- Vacation ------  ----- Sick Days ------  ----- Comp Days
    -----

      PATTERN:
    --------------------------------------------------------------------------------

    Figure 17 -- Change Heading Values

    The caption line you specified is now displayed above the second text line of quantities. Now add a second caption line below the line just created.

    To add another line:

         DO THIS:
    Position the cursor on the "Vacation" caption line and press  PF14.
       

    A dummy "--NEW---" field will be generated and displayed, just as before. Now we will update that dummy field so as to create a second line of headings above the vacation, sick, and comp time amounts.

         DO THIS:
    Then position the cursor on the "--NEW---" field and Press PF18.
       

    You have now selected the dummy field for update.

    
     RPTDEF 600B                           Data UPDATED on Database
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 04  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 ----- 
    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:

    Figure 18 -- Inserting Another Line

    For the "--NEW--" field just generated to establish another new line:

         DO THIS:
    Change the PIC Clause to X(00070), key in the HEADING Value as shown in Figure 19 and Press ENTER.
       

    
     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 ----- 
    --NEW---
    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
    --------------------------------------------------------------------------------
    FIELD NAME:  PRINT-003-002  PIC: X(00070)
     DISPLAY: Y  BWZ: N TOTAL: N  AVG: N  LGTH= 070
     SORT SEQUENCE: 0  DIR:  CTL BRK: N  HOF PRE-BRK: N  POST-BRK: N
    SOURCE/TARGET: *  TYPE= X  SIG= 00  DEC= 00
      HEADING:  Earned  Taken  Earned  Taken Earned  Ta
    ken

      PATTERN:
    --------------------------------------------------------------------------------

    Figure 19 -- Second Caption Line Heading

    Figure 20 shows the Report Layout as we have defined it with the Caption lines for the second detail line.

    Controlling Sort

    The automatic report generator initially defaults your report to three sort fields and three levels of breaks. Experience has shown that this is probably the most common configuration. Further it assumed that the first three fields you selected on the report are the ones you wish to sort on, in that order. Here, in the report painter, you can override any of those defaults.

         DO THIS:
    Press PF10 to view sort key definition.
       

    
      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  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 

    Figure 20 -- Report Display with Captions

    Figure 21 shows the default sort keys generated.

    MAGEC supports up to nine (9) sort fields, each may be either ascending or descending sequence. You can have control breaks (total lines) for any sort field(s), or for none of them.

    The sort indicators above the field display show the sort direction (A=ascending, D=descending) and the sort levels (1=major, 2=intermediate, 3=minor, etc). Remember there can be up to nine levels. If there is to be a control break for each respective level, the direction indicator (A or D) will be shown in upper case. If there is not to be a control break, it will be in lower case.

         DO THIS:
    Place the cursor on the first sort key field and press PF18.
       

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 01  COLS:  001 - 080  RPT:  MBP600B  -  VACATION REPORT
    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    A1......  A2.......................  A3.............
    MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX



    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-







    (PF KEYS)  --FIELD: 18=CHG  19=DEL  20=ADD  16=CUT/COPY  10=RPT-LINES

    24=SHOW DISPL-FIELDS  12=GO TO BCHPGM

    Figure 21 -- Sort Key Fields

    You will notice that a Field Detail Specification area is displayed on the screen, similar to the information displayed when changing any display field.

    To effect the desired change, merely overkey the specification that needs changing.

         DO THIS:
    Turn to the next page.
       

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 01  COLS:  001 - 080  RPT:  MBP600B  -  VACATION REPORT
    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    A1......  A2.......................  A3.............
    MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX



    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    --------------------------------------------------------------------------------
    FIELD NAME:  PRINT-DATE-HIRED  PIC: X(8)
     DISPLAY: Y  BWZ: N TOTAL: N  AVG: N  LGTH= 008
     SORT SEQUENCE: 1  DIR: A  CTL BRK: Y  HOF PRE-BRK: N  POST-BRK: N
    SOURCE/TARGET: VAC01-DATE-HIRED  TYPE= M  SIG= 02  DEC= 00
      HEADING: Hire Date

      PATTERN:
    --------------------------------------------------------------------------------

    Figure 22 -- First Sort Key Specifications

    In order to make the oldest date print first on the report, you must sort the hire-date in descending sequence instead of ascending sequence. Also, we don't want control breaks on this key.

         DO THIS:
    Key in the changes as shown in Figure 23 for the "DIR" field and the "CTL BRK" field, and press ENTER.
       

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 01  COLS:  001 - 080  RPT:  MBP600B  -  VACATION REPORT
    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    A1......  A2.......................  A3.............
    MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX



    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    --------------------------------------------------------------------------------
    FIELD NAME:  PRINT-DATE-HIRED  PIC: X(00008)
     DISPLAY: Y  BWZ: N TOTAL: N  AVG: N  LGTH= 008
     SORT SEQUENCE: 1  DIR: d  CTL BRK: n  HOF PRE-BRK: N  POST-BRK: N
    SOURCE/TARGET: VAC01-DATE-HIRED  TYPE= M  SIG= 02  DEC= 00
      HEADING: Hire Date

      PATTERN:
    --------------------------------------------------------------------------------

    Figure 23 -- First Sort Key Changes

    Notice that the sort indicator above the first sort key is now lower case indicating no control breaks, and a value of "d", indicating descending sequence.

    For our example report, we do not want any control breaks, except for the Grand Total break which is always generated at the end of the report. We will update each of the other sort fields such that they do not have control breaks specified.

         DO THIS:
    Cursor select each of the remaining two sort Key fields for change (PF18),  altering
    
    the CTL BRK parameter to "n" for each field.    

    The display will reflect your changes by displaying "a2" and "a3" where "A2" and "A3" were being displayed before the changes.

    
     RPTDEF 600B                           Data UPDATED on Database
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 01  COLS:  001 - 080  RPT:  MBP600B  -  VACATION REPORT
    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    d1......  A2.......................  A3.............
    MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX



    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-







    (PF KEYS)  --FIELD: 18=CHG  19=DEL  20=ADD  16=CUT/COPY  10=RPT-LINES

    24=SHOW DISPL-FIELDS  12=GO TO BCHPGM

    Figure 24 -- Sort Key Updated

    Now that the sort key specifications are as we want them, with none of the sort fields requesting for control breaks, and with the first sort key field (Hire Date) sorting in descending sequence. Let's return to the Report Display.

         DO THIS:
    Press PF10.
       

    
     RPTDEF 600B 
    
      M A G E C  BATCH PROGRAM GENERATOR  REPORT DEFINITION SCREEN
    LINE: 01 - 01  COLS:  001 - 080  RPT:  MBP600B  -  VACATION REPORT
    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-
    d1......  a2.......................  a3.............
    MM/DD/YY  XXXXXXXXXXXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXX



    ...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-KEY-FIELDS...SORT-







    (PF KEYS)  --FIELD: 18=CHG  19=DEL  20=ADD  16=CUT/COPY  10=RPT-LINES

    24=SHOW DISPL-FIELDS  12=GO TO BCHPGM

    Figure 25 -- Sort Key Changes Complete

    Now combine the headings for the two "Name" fields in the first detail line to just "Name".

         DO THIS:
    Cursor select the "First Name" field and Press PF18.
       

    NOTE:

         DO THIS:
    Change the HEADING value to spaces and press ENTER.
       

         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 of characters as the detail line display for that field, it may be shorter or longer. If you set or alter a heading to be longer than it was as originally generated you may also need to alter the size of the FILLER following that detail item for alignment. This is to prevent having the heading literal overlap the heading for the next (left-to-right) field.

    You can specify multi-line headings, as well (for fields appearing on the first line of detail, only). To make a heading multi-line, simply use the semicolon character (;) as a "new line" character. For example, a heading specified as:

    Date Employee;  Fired  

    would appear on the report, and on the report painter display screen, as:

    Date Employee
      Fired
     

    NOTE:

    
     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:

    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 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, multi-line detail, multi-line headings. It can be used to generate reports which print on complex pre-printed forms up 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 MAGEC. Through customization, there is literally no limit to what can be done other than the limitations of Cobol 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 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 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 it for you, you can specify to MAGEC that you desire automatic editing to be done to report fields. You do this by 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 auto-paint feature (for online screens) or the automatic report program generation MAGEC sets the screen or report editing formats based upon the edit type codes found in the DIT definitions. You can override them in the MSKDEF or 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 (i.e.. ZZZ.99-) based on the edit type. You might refer to the chapter "Analysis of the Generated MMP" (in the 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 validated by looking them up in a MAGEC lookup table. You can define lookup tables and the valid entries in those tables. Refer to the MAGEC "Database Administration" chapter for further details about lookup 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.

    Date Edit Types:

    M MM/DD/YY or MM/DD/CCYY (2 or 4-digit years).

    D DD/MM/YY or DD/MM/CCYY (2 or 4-digit year).

    Y YY/MM/DD or CCYY/MM/DD (2 or 4-digit year).


    Appendix C --  Most Used Online Functions

    Developer's Functions

    These are some of the most frequently used online MAGEC functions for application developers.

    ALGLST mmm Directory of custom. algs. for mask mmm
    ALGxxx mmm/pppppppp/etc. Inquiry & maintenance for custom algorithms
    BCHPGM nnnB Create batch report program
    BCHLOC nnnB Locate batch report headers
    DBDITO Character/hex record display/update
    DBUTIL Character/hex record display only
    DOCxxx topic name Inquiry/maintenance for documentation
    ERRxxx eee Inquiry/maintenance for error msgs
    LBRxxx member/modifier Inquiry/maintenance for lib member
    LBRLST 1 List directory of library members
    MMPxxx nnn Inquiry/maintenance for MMP headers
    MSKDEF mmm Manual screen painting
    MSKDEL mmm Delete mask detail
    MSKDUP mmm Duplicate mask detail
    MSKSEE mmm Display generated mask
    PAINT1 mmm (thru PAINT7) Automatic Screen Painter
    RPTDEF nnnB Report Painter
    RPTDEL nnnB Delete report detail
    RPTDUP nnnB Duplicate report
    SCDLST mmm List locate headings for mask mmm
    SCDCHG mmm/row/col Change locate heading for field
    SCDTBL ttt Where-Used for Table number
    TBLLST ttt List lookup table entries
    TBLxxx ttt/cccc Inquiry/maintenance for table entry
    TOCLOC ttt List table of contents for lookup tables
    TSKLST mmm Developer's task list
    VERZUN MSKmmm Version verification for application
     

     

    LEGEND: mmm Mask number
    xxx Standard nine suffixes (ADD, CHG, etc.)
    ttt Table number
    nnn MMP/MBP number: (pattern: 9xx)
    pppppppp Insertion point name
    cccc 1 thru 16-character code
    eee Error number

     

    Program Function Keys used in Developer's Functions

    PF Keys (general)

    PF15 Exit MAGEC

    PF9 Swap Windows

    PF12 Return to TSKLST (from a development function)

    PF1 HELP key

    PF2 Field-level HELP

    PF16 Copy data to Copy/Paste buffer

    PF17 Paste date from Copy/Paste buffer

    PF24 Pop-Up short list from prior browse/query

    PF11 Help Index

    PF13 Hardcopy (if Spooler installed)

    PF8 Page Forward/Next

    PF7 Page Backward/Previous

    PF Keys in Pop-Up Window

    PF16 Copy data to Copy/Paste buffer, remove Pop-Up

    PF24 Cursor-select from short list, remove Pop-Up

    PF Keys in MSKDEF

    PF18 Change field

    PF19 Delete field

    PF20 Duplicate field

    PF4 Duplicate line

    PF5 Erase all fields on a line

    PF6 Move line

    PF21 Move field

    PF10 Go to Auto-Paint sequence (if no screen fields exist)

    Execute online MSKCRE (if screen fields exist)

    PF13 Delete a blank line

    PF14 Insert a blank line

    PF24 Pop-Up help window

    PF Keys in PAINT2 and BCHPG2

    PF7 Scroll Backwards

    PF3 Return to PAINT1 or BCHPGM

    ENTER Select item

    PF4 un-select item

    PF6 Done selecting data items

    PF10 un-select all items

    PF Keys in DBDITO and DBUTIL

    PF23 Display next 280 bytes of this record

    PF22 Display previous 280 bytes of this record

    PF8 Read next record (forward)

    PF7 Read prior record (backward)

    PF Keys in LBRxx and ALGxxx

    PF8 Page forward thru member

    PF7 Page backwards thru member

    PF20 Insert after line where cursor is positioned

    PF5 Bypass warning-level errors and update

    PF16 Copy a line (or many lines using CC - CC)

    PF17 Paste line or lines from Copy/Paste buffer

    PF Keys in PAINT1 and BCHPGM

    PF5 Bypass warning-level errors and continue

    PF Keys in RPTDEF

    PF18 Change field

    PF19 Delete field

    PF6 Return to BCHPGM screen

    PF21 Move a field

    PF22 Display next 80 columns of report (shift right)

    PF23 Display previous 80 columns of report (shift left)

    PF20 Add a field to the right of cursor

    PF10 Toggle between SORT-KEY display/REPORT display

    PF4 Line Duplicate

    PF5 Line Erase 

    PF6 Line Move

    PF13 Line Delete

    PF14 Line Insert (ADD)

    PF24 Toggle between display/non display fields

    PF12 Escape to BCHPGM screen


    Appendix D --  Universal Functions

    Logical Application 00's Functions

    The following functions are part of logical application 00. They appear on the menu for every other logical application and can be done by anyone using MAGEC.

    OPTION Set session option for CLEAR and PA1 key

    **HELP Menu-driven review of help text

    **SWAP Swap windows (same as pressing PF9)

    **EXIT Exit MAGEC
    (same as pressing PF15)

    **PF01 thru **PF24 Simulate PF key entry

    **PA01 thru **PA03 Simulate PA key entry

    **ERR1 HELP (same as pressing PF1)

    **MENU High level menu

    ++MENU Intermediate level menu

    $$MENU Low level menu

    MSGSEE Display broadcast message

    BROWSE BACKWARD Set browse direction to backwards for LOC, SCN,
    and FND functions

    BROWSE FORWARD Set browse direction to forward for LOC, SCN, and
    FND functions

    CLEARS Display MAGEC logo screen

    SYSLOG ON Log on to MAGEC

    SYSLOG OFF Log off of MAGEC


    Appendix E -- Modifying Specifications

    BCHPGM Screen

    The specifications you enter on the BCHPGM screen (first screen in the batch report program development process) control how the report fields are generated. These report fields are displayed to you in a graphical format on the RPTDEF screen. RPTDEF is the "report painter" screen.

    If you wish to alter some of these specifications after you have generated the report, you might need to delete the report detail fields from RPTDEF in order to re-generate them. This is true for those specifications which affect the layout of a report (spacing between fields, centering, etc.). To delete the report detail field definitions you should use the RPTDEL function, as:

    RPTDEL nnnB  

    This is similar to RPTDEF, in that it shows you a graphic image of your report layout  It does this, however, so you can confirm that you indeed wish to delete this report.

    NOTE:

    Once you are shown the report layout, you will have three options available to you.

    If you press ENTER, only the report field definitions will be deleted, the header information and field selections will be retained. You could then return to the BCHPGM screen, alter some of the specifications, and re-generate the report using the changed specs. You could also alter the field selections, if you desired.

    After you have deleted the detail field definitions the BCHPGM screen will automatically transfer you to the field selections screen(s). The selections you had made before will still be "remembered" so that you need not re-do them. You can alter the selections using all the standard PF key operations that you had available to you when you originally made your selections.

    If your report included logical joins you will next be taken to the logical join coding screen. If you wish to re-do the join logic you can enter it here just as you did originally. If your original logical join coding does not need any changes, you can press PF10 on this screen to bypass the logical join process and proceed directly to the report painter screen, RPTDEF. If you press PF10 no modifications will be done to the logical join coding (stored as %JOIN customization) for your application. Any changes you might have made to it previously will be retained. If you press ENTER, rather than PF10, the coding on the screen (plus any lines of code you type in) will be stored as %JOIN customization replacing what was already on file.