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:
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.
DO 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.
DO THIS: |
DO THIS: |
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:
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.
The Sample Report
2) SIF security information file
DO THIS: |
BCHPGM 600B |
DO THIS: |
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 |
DO THIS: |
BCHPG2 600B PF8=Forward / PF7=Backward / PF5=Top |
DO THIS: |
BCHPG2 600B PF8=Forward / PF7=Backward / PF5=Top |
DO THIS: |
DO THIS: |
NOTE:
BCHPG2 600B |
DO THIS: |
BCHPG2 600B PF8=Forward / PF7=Backward / PF5=Top |
DO THIS: |
BCHPG2 600B PF8=Forward / PF7=Backward / PF5=Top |
DO THIS: |
BCHPG2 600B PF=Forward / PF7=Backward / PF5=Top |
DO THIS: |
BCHPG7 600B |
DO THIS: |
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 |
DO THIS: |
RPTDEF 600B |
DO THIS: |
NOTE:
RPTDEF 600B ++ Field Selected for MOVE Function ++ |
DO THIS: |
RPTDEF 600B |
DO THIS: |
NOTE:
RPTDEF 600B Data UPDATED on Database |
DO THIS: |
RPTDEF 600B |
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.
DO THIS: |
RPTDEF 600B |
NOTE:
DO THIS: |
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 |
DO THIS: |
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: |
You have now selected the dummy field for update.
RPTDEF 600B Data UPDATED on Database |
NOTE:
DO THIS: |
RPTDEF 600B |
DO THIS: |
RPTDEF 600B Data UPDATED on Database |
DO THIS: |
RPTDEF 600B |
DO THIS: |
RPTDEF 600B |
DO THIS: |
RPTDEF 600B |
DO THIS: |
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 |
DO THIS: |
RPTDEF 600B |
DO THIS: |
NOTE:
DO THIS: |
DO THIS: |
DO THIS: |
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 |
NOTE:
Now it is time to generate the program and execute it.
Generate and Execute the Batch Report Program
DO THIS: |
If you are doing the project on a PC:
DO THIS: |
DO THIS: |
If you are doing the project on a mainframe:
DO THIS: |
DO THIS: |
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 |
MBP600B VACATION REPORT PAGE 1 |
MBP600B VACATION REPORT PAGE 2 |
MBP600B VACATION REPORT PAGE 3 |
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.
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:
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.
AlphaNumeric Edit Types:
Numeric Edit Types:
Date Edit Types:
Appendix A -- Deleting Sample Report Program
If Sample Report is Already Done
Appendix B -- Edit Type Codes
Automatic Editing
Table of Edit Types
X
Miscellaneous fields, any characters will be accepted. Example: company name, comments.
Same as X.
b
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.
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.
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).