Information Technology Reference
In-Depth Information
To illustrate the program translation from relational to hierarchical, we must
show the syntax for translating each SQL to a hierarchical database management
language of IMS (a hierarchical DBMS). There are four parameters in IMS database
management language. They are:
• Functioncode, which defines the database access function
• Programcontrolblock, which defines the external subschema access path
• I-O-Area, which is a target segment address
• Segmentsearchargument,whichdefinesthetargetsegment selection criteria as
follows:
CALL “CBLTDLI” USING FUNCTION-CODE
PCB-MASK
I-O-AREA
SSA-1
SSA-n.
After the schema translation, we create an open database by adding secondary in-
dices to the IMS schema. Further, at runtime, we map an SQL statement to a series
of IMS DML statements. The overall methodology for program translation from a
relational to a hierarchical model can be described with a procedure similar to those
previously described for converting from the network model to the relational model:
Preprocess step 1. Schema translation.
Preprocess step 2. Data conversion.
Step 1. Translate SQL to hierarchical database DML:
Program translation can be completed in a similar manner to the network data-
base. By the addition of secondary indices we can translate the relational SQL into
the hierarchical database DML.
The algorithms and procedures are similar, except for the Update operation. An
update operation that alters the value of a foreign key in the relational database can-
not be directly translated to a hierarchical database such as IMS. This is because the
linkages between parent and child segments are fixed and the parentage, once estab-
lished, cannot be changed. To change the linkage, we must write a special program
that copies the child segment and its dependent segments to a new child segment,
and then deletes the old child segment. On the other hand, if we update a non-key
field, the process is simple. The Update operation in a relational database can be
translated to the hierarchical database using the following algorithm:
Search WWH ::




Custom Search