Proper use of the Domain facility of MAGEC will enable MAGEC to further automate the application development processes, specifically the logical joining of files.
Consider the situation in which you have two Data Classes (files), as:
CUS Customer data
**IVC Invoice data
Now, suppose that the key to the customer data was customer number, which was defined as a Data Item named (cont.)
"CUS01-CUSTNO". Also suppose that there is a Data Item in the invoice record named "IVC01-CUST", and that it contains (cont.)
the customer number. Further suppose that both these Data Items are defined as belonging to the Domain (cont.)
"CUSTOMER-NUMBER". MAGEC now has enough information to know that it can construct an exact key for the customer file by (cont.)
MOVE'ing IVC01-CUST to CUS01-CUSTNO; therefore, it can fully automate the logical join process when an application (cont.)
needs to access the invoice data and join customer data.
Logical joining can be done without any Domain definitions or usage; however, it involves more effort by the (cont.)
application developer to build the key used to access a file. Use of the fully automated joining via Domains also gives (cont.)
the Database Administrator better control over how data is accessed.
Figure 27 -- Join Via Domains
##
Suggestions Regarding Domains
The process used to automatically join data can be repeated for many levels. Thus, after reading the Invoice data and (cont.)
then joining the Customer data to it, you could possibly use the ZIP code from the Customer data to join another file (cont.)
which is keyed by ZIP code, and so on. You can even concatenate data items from more than one file to build the key to (cont.)
access another file. This automatic logical join facility is potentially powerful enough to eliminate almost all manual (cont.)
coding of file accesses by programmers. It depends, however, on your properly defining and using Domain (cont.)
definitions.
We suggest that you should always try to identify and specify Domain Names for those Data Items which are part of (or (cont.)
all of) a record key. Likewise you should always try to specify (the same) Domain Names for foreign keys within your (cont.)
records. This will not only help automate application development, it will also give you excellent documentation of (cont.)
relationships between Data Classes. The Where-Used reports and screens will be much more valuable to you than if you (cont.)
haphazardly (or not at all) use Domains.
When designing new files/tables, you should give consideration to identifying Domains for as many of the new Data Items (cont.)
as possible. This will help you to ensure uniform definitions and usage. You should also try to apply those Domain (cont.)
definitions to your existing Data Items--the minimum you will gain is a knowledge of which ones are inconsistent, the (cont.)
maximum is global standardization.
The offline utility program, MAGECLBR, contains a function to report usage for any Domain Name. It also has a function (cont.)
to make any necessary alterations to all Data Items belonging to a Domain in order to make them compatible. This would (cont.)
enable you to, say, change ZIP-CODE from a 5-digit numeric to a 9-digit numeric GLOBALLY*. Obviously, Element and (cont.)
record lengths might need to be adjusted after you did this. The control cards for MAGECLBR to produce a Where-Used (cont.)
report and to globally alter definitions are, respectively:
-MAGECUSE DOM dddddddddddddddddddd
-MAGECGBL DOM dddddddddddddddddddd
Where ddddddddddddddddddddd is the Domain Name. The Where-Used report will note any inconsistencies without altering (cont.)
any definitions. You should use it whenever you have a question regarding any given Domain.
You can get a quick online Where-Used display for any Domain by simply displaying its definition (using DOMSEE), and (cont.)
pressing PF6. The information will not be as thorough as from the hardcopy report from MAGECLBR, but it is often (cont.)
sufficient and it is much handier to obtain.
When adding Domain definitions, remember that they are identified by a six-digit unique number, and that the numbers (cont.)
from 000001 through 000100 are reserved for "figurative constant" or "literal" Domains, which have special meaning for (cont.)
the automatic logical join process.
*MAGEC Software* has plans to implement additional features which are to be driven by these Domain definitions in future releases of MAGEC. Your input and ideas will be appreciated.
#
Appendix A -- Deleting Definitions
##
Restoring/Reloading MAGEC Dictionary
For a number of reasons this project, and the other turorial projects, are best done on a microcomputer, rather than on (cont.)
a mainframe. Being the sole user of the system allows you to do things which would be very un-neighborly on a (cont.)
multi-user mainframe. If you are doing this project on a PC or PS/2 using the PC version of MAGEC, you might be able to (cont.)
simply re-install part of MAGEC's dictionary to delete the VAD definitions. Using the initial installation diskettes (cont.)
you could, at the DOS prompt, enter the commands:
C:
CD\MAGEC
RESTORE A: DCLK1.DAT
RESTORE A: KYFK1.DAT
RESTORE A: ELTK1.DAT
RESTORE A: ALGK1.DAT
This assumes that your \MAGEC directory is on the C: drive and that the diskettes are on the A: drive; you may need to adjust the above for your particular situation.
##
Un-Defining VAD Data Class
Whether you are using a PC or mainframe you can un-define the VAD Data Class. To delete all definitions for the sample VAD Data Class and all subordinate entities:
In all environments:**
Online, in MAGEC, do the following functions:
DITPUR VAD01
LBRPUR VAD01-C
RULPUR VAD01
ELTDEL VAD00
ELTDEL VAD01
KYFDEL VADK1
DCLDEL VAD
**On a PC:**
*Also*, issue the following command from the DOS prompt:
ERASE C:\MAGEC\VADK1.DAT
#
Appendix B -- DB Commands
The following is a list of DB Commands which may be used with DBDITO. For more detailed information, please refer to (cont.)
the *MAGECIO Commands* topic in the "Database Administration" chapter (section, Accessing Files from (cont.)
Programs).
COMMAND FUNCTION
REDKY read record for key value in the screen data area
REDNX read the next record from the one just read
REDPR read the previous record (not on Datacom DB)
REDID re-read the record just read
RDUKY same as REDKY but with intent to update
RDUID same as REDID but with intent to update
RDUNX same as REDNX but with intent to update
LOCKY locate record with key = or > the screen data area
LOCKX locate record with key = the screen data area
LOCNX locate next record from one just read or located
FSTAT test file status (open or closed, etc.)
REDLE read the record just located
UPDAT update the record
DELET delete the record
RELES release the record just read-with-intent
ADDIT add a record
**
NOTE:
**
Datacom/DB supports all of the above commands plus a list of additional ones. If you are accessing a Datacom/DB (cont.)
file/database, you can use any legal command and it will be passed through to Datacom's DBENTRY entry point and the (cont.)
results displayed to you.
#
Appendix C -- Edit Type Codes
##
Automatic Editing
When you define your mask using MSKDEF, 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 screen 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 (as in the "Batch Developer" (cont.)
Tutorial) MAGEC sets the screen or report editing formats based upon the edit type codes found in the DIT definitions. (cont.)
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 (cont.)
(ie. ZZZ.99-) based on the edit type. You might refer to the chapter, "Analysis of the Generated MMP" (found in (cont.)
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 will be validated by looking (cont.)
them up in a MAGEC lookup table. You can define lookup tables and the valid entries in those tables. Refer to the MAGEC (cont.)
"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, lowercase 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.
-
(hyphen)
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).
**
NOTE:
**
When the operator enters data into screen fields MAGEC accepts any valid, unambiguous format depending upon the edit type. For instance, in a type-$ field the operator may enter:
12345.5 or,
**1,234.50 or,
$1,234.50 etc.
#
Appendix D -- User Abend
Sometimes you might wish to abend an online task issuing an error message to the operator. This is useful when you wish (cont.)
to cause Transaction Backout to be invoked, or when you just want to stop processing because your program has sensed (cont.)
error conditions beyond its capacity to deal with.
This can be accomplished easily via the ABEND command which is handled in MAGEC's I/O module.
To use the ABEND command, code:
MOVE 'ABEND' TO TWA-DB-REQUEST.
MOVE xx TO TWA-DB-RETURN-CODE.
MOVE 'mmmmm' TO SCOMPL.
PERFORM AA840-CALL-MAGEC-IO THRU AA899-EXIT.
In the above example, xx is a two-character abend code which you may set. MAGEC will abend the task issuing a CICS (cont.)
abend code of MUxx (MU is for MAGEC USER ABEND). The mmmmm is any 40-character message you would like (cont.)
displayed.
NOTE:
**
Control passes to the I/O module which aborts the task. Control does not return to your program. If an Abend Handler (cont.)
program has been specified for either your MMP (refer to the definition of the "Screen Header" in the Application (cont.)
Developer Tutorial) or for the User View (refer to the discussion of "Global Parameters" in the *Installation Guide*), (cont.)
then the Abend Handler program will be invoked. Since you can code an Abend Handler program, it might do anything you (cont.)
next: data10.md.txt