03 DB-RETURN-CODE PIC X(2).
88 NOT-FOUND VALUE '14'.
88 REC-FOUND VALUE ' '.
88 DUP-RECORD VALUE '10'.
03 FILLER PIC X(61).
03 DB-KEY-VALUE PIC X(256).
03 AUDIT-STAMP-AREA.
-MAGECINC ELT00-C
01 FILLER.
03 DB-ELT00 PIC X(6) VALUE SPACE.
03 DB-ELT-LIST.
05 DB-ELT OCCURS 17 TIMES PIC X(6).
01 DB-DATA-AREA.
..... insert -MAGECINC's for element copybooks here .....
```**
The exhibit shows the standard areas. The ELT00-C copybook expands to define the 36-byte audit stamp.
##
File Opens
When using the batch I/O module you have several options as to the opening of files you will be accessing. Special database commands are provided to give you the flexibility needed for your programs.
MAGDBMS will automatically open a file the first time you access it, if it is not already opened. This is known as an (cont.)
implicit open. This enables you to easily convert programs which were originally written to access Datacom/DB (which (cont.)
also normally uses the implicit open).
There are two ways that a file can be opened: open for update and open for read only. Unless you alter the default (cont.)
parameter, an implicit open will be for read only. If you wanted to alter the default so that implicit opens were for (cont.)
update, you would use the *LOAD command. To alter the default back to read only, use the *READ (cont.)
command.
You can also do an explicit open of a file by using one of two commands: OPENU or OPENR. The OPENU command opens the file for update, the OPENR command opens the file read only.
You can explicitly close a single file or *all *open files. The CLSFL command will close a single file, you specify it (cont.)
by the Element names in the element list. The *CLSE command closes all open files.
##
Batch Security
The same rules regarding the audit stamp apply in batch as in online programs. You may interrogate, but not update, the (cont.)
audit stamp. MAGDBMS automatically posts to it when you add or update. Pseudodeletion is also supported from the batch (cont.)
I/O module.
#
Where-Used Reporting
##
MAGECLBR
In the course of developing and maintaining applications we often find the need to know where a certain Data Item (cont.)
(field) or a certain Element is being used throughout all systems. This enables us to determine the impact of some (cont.)
proposed change before actually making it. It can also help us to ensure that various items of data are treated (cont.)
uniformly across systems. The MAGECLBR utility program produces a formatted Where-Used report for either an Element or (cont.)
an "include member". The online global search facility incorporated into the LBRSEE function allows a search for all (cont.)
references to a specific Data Item.
To use MAGECLBR to produce a Where-Used report, execute the jobstream MAGLBREX (described in the "Offline Utilities" chapter) with one of the following control cards:
-MAGECUSE ELT eeeee
where:
eeeee
= Element name
-MAGECUSE LIB nnnnnnnn/mmmmmmmm
where:
nnnnnnnn
= member name
mmmmmmmm
= its modifier (as appropriate)
-MAGECUSE DIT xxxxxxxxxx
where:
xxxxxxxxxx
= dataname (may be generic using dot or asterisk)
-MAGECUSE TBL ttt
where:
ttt
= table number
-MAGECUSE DOM domainname
where:
domainname
= domain name (up-to 20 characters)
MAGECLBR will search for all references in both online MMP's and in batch MBP's, or in any other programs which have (cont.)
their source code catalogued to the MAGEC library. You can catalogue "raw" source code to the library using MAGECLBR (cont.)
with a control card as follows:
-MAGECADD LIB nnnnnnnn/mmmmmmmm
followed by the data to be catalogued. Further information about MAGECLBR can be found in the "Offline Utilities" and "Librarian" chapters.
To do a global search online for references to a dataname (or other character sequence) enter:
LBRLST 1
(a list of members will appear)
Next, position the cursor down to the first item on the list (or whichever member you would like to begin your search (cont.)
with) and press the ENTER key. Next, key the desired dataname (or character string) into the **Search Arg** field and (cont.)
key
$GBL
into the **Password **field and press the ENTER key. You will be presented every reference to the desired dataname and (cont.)
instructed to press ENTER to continue searching after each one. The member names and their modifiers (if appropriate) (cont.)
will be shown on the top lines of the display. This same facility can be done using the ALGLST 1 command to begin the (cont.)
search, instead of the LBRLST 1 command. In that case you would be scanning Customization Algorithms rather than (cont.)
ordinary Library members.
##
SCDTBL
There is an online function which you can use to search for references to a MAGEC table. It will display a list of (cont.)
applications which have a given table number specifed as the lookup table for a screen field. The command (cont.)
is:
SCDTBL nnn
where:
nnn
= the desired table number (001 through 255)
In order to limit online overhead the search is subjected to the standard "scan limit" or 1000 I/O's before it is interrupted. You can press ENTER to continue the search; however, if you wish.
##
DCLDOC
A special batch utility program is provided (MAGEC version 2.1 and later) to produce complete documentation for a Data (cont.)
Class, including where-used reporting. The DCLDOC program accepts a control card (multiple control cards are permitted) (cont.)
specifying the 3-character name of the Data Class for which you wish documentation printed. It reports on all Keys, (cont.)
Elements, Data Items, Business Rules, and references. The where-used reference report shows both primary and joined (cont.)
references for both online MMP's and batch MBP's.
To invoke the report, execute DCLDOC with a control card as:
DCLDOC xxx
where:
xxx
=a Data Class name in columns 8-10 of the control card
If you wish to have all lowercase alphabetics in the printed oputput converted to uppercase, use a control card as:
DCLDOC xxx U
where:
U
= literal "U" in column 12, a "Y" is equivalent to "U".
##
Business Rules
When you are entering or maintaining Business Rules online it is often useful to be able to see a where-used report to (cont.)
indicate which programs will be affected (need to be recompiled) if you alter this rule. From any of the RULxxx or (cont.)
ELTxxx functions' screens you can press PF6 to request such a report. The results wil be displayed to you online. You (cont.)
could also enter the command:
RULUSE eeeee
where:
eeeee
= the desired element name
##
Domains
Global Changes
An offline facility is provided to help you to make global changes based upon Domain definitions. This enables you, for (cont.)
example, to change all zip codes from five digits to nine digits. That assumes, of course, that all zip code fields in (cont.)
all files are defined as belonging to the same Domain.
To make such a global change you would first alter the definition of the Domain. This is done online using the DOMCHG (cont.)
function. Next you should run a where-used report to give yourself documentation of all references that are going to be (cont.)
altered. *You may skip this step at your own peril!* The global change operation will also produce a report of what was (cont.)
changed, but you might prefer to know what will be changed beforehand, then compare it to the report produced (cont.)
after-the-fact.
Finally you would execute the global change operation. To do so you would execute the MAGECLBR batch utility using a control card of:
-MAGECGBL DOM dddddddddddddddddddd
where:
dddddddddddddddddddd
= the desired Domain name
This operation will alter the Data Item definitions for all fields affected. It will not alter any Element, Data Class, (cont.)
Key, or file definition (i.e. IDCAMS) parameters. It is up to you to make any needed changes to record lengths, key (cont.)
lengths, element lengths, or displacements. It may also be necessary to unload, reformat, and reload the data from the (cont.)
files. The reports produced should provide you with a checklist of modified Data Items and Elements
the rest is up to you.
#
File Reorganization
MAGEC's dictionary files are simple VSAM KSDS (on the mainframe) or standard indexed files (on the PC). They are single (cont.)
key files (no alternate indices). They should be occasionally backed up and reorganized to maintain optimum (cont.)
performance. The method used to reorganize these files is no different from the method used to reorganize other such (cont.)
files in your environment. MAGEC provides some assistance in the form of pre-coded IDCAMS (or AMSERV) control cards (on (cont.)
the mainframe) and a .BAT file (on the PC).
##
Mainframe
There are three members on the MAGEC library (ALG file) which will help you to reorganize the dictionary VSAM files. They are:
IDCAMBKP/REPRO
**IDCAMRST/REPRO
DEFFILES/VSAM
The procedure for reorganizing and backing up the files involves:
1)
backup to tape using the IDCAMBKP/REPRO control cards,
2)
deleting and redefining the files to the VSAM catalogue using the DEFFILES/VSAM control cards, and
3)
reloading the files using the IDCAMRST/REPRO control cards with the tape from step 1 as input.
The control cards provided are merely samples. You may wish to customize them for your particular environment. In the (cont.)
backup and restore control cards you will notice the NOREWIND parameter specified. The MVS version of IDCAMS does not (cont.)
support that option, so you will want to remove it if you are an MVS installation.
##
PC
The PC (simulated) VSAM files can be reorganized using a .BAT or .CMD file provided with MAGEC. It is necessary to have (cont.)
enough disk space available on your hard disk drive to hold another copy of the file being reorganized since the (cont.)
process involves copying the file to a new, reorganized file and then erasing the old one and renaming the new one to (cont.)
the proper name. All simulated VSAM files in MAGEC have an extension of .DAT (for your information). The .BAT file is (cont.)
named: REORG.BAT and is in the \MAGMF\JCL directory. To invoke it, at the DOS prompt enter the (cont.)
command:
REORG xxx
where:
xxx
= the Data Class name to be reorganized)
Although this procedure is generally very safe, it is smart to first backup your hard disk to tape (or other medium) before doing any reorganizations.
##
TWA File Purge
The TWA file is used by all online transactions as a place to store data to be passed from transaction to transaction (cont.)
and from program to program. There are several different types of records stored on the file for various purposes. Some (cont.)
of them are simply to provide pseudo-conversational processing for all transactions without imposing the need for the (cont.)
programmer to handle the saving of passed data and so forth. Other types of records are used by the online help (cont.)
facility, window swapping, and other integral features of MAGEC.
The records on the TWA file have various different keys that identify what they are for; however, in all cases the keys (cont.)
are eight characters long and begin with the four-character terminal ID that makes the keys unique. This scheme also (cont.)
gathers all records for a given terminal in physical proximity to one another.
*Regular reorganizations of the TWA file are highly recommended.*
All of the records on the TWA file are dynamically created (added) whenever they are first needed, then they are reused (cont.)
(updated) as they are subsequently needed. For example, online documentation records will be created the first time (cont.)
that online documentation is used at a given terminal, then merely updated as online documentation is subsequently used (cont.)
at that terminal.
This scheme works well and reduces overhead significantly; however, it has one drawback. The TWA file can become (cont.)
over-populated with records for terminals that are no longer active. There are three good methods for solving this (cont.)
problem.
*First*. You can totally purge the TWA file and re-initialize it. This lets MAGEC dynamically re-add any needed records (cont.)
as the need for them arises. The adding of records is less efficient than updating in place, but the penalty is usually (cont.)
small and this method is a sure-fire way to solve the over-population problem.
To do this you should execute the IDCAMS DELETE/DEFINE, then execute MAGINIT to initialize the file. This could even be done in the online startup JCL, if desired.

next: db08.md.txt