TurboIMAGE/XL and QUERY/V [ Getting Started as an MPE/iX Programmer Programmer's Guide ] MPE/iX 5.0 Documentation
Getting Started as an MPE/iX Programmer Programmer's Guide
TurboIMAGE/XL and QUERY/V
Together, TurboIMAGE/XL and QUERY/V provide a database management system.
TurboIMAGE/XL is a set of programs and procedures you can use to define,
create, access, and maintain a database. QUERY/V is a database inquiry
facility that provides a simple method of accessing a TurboIMAGE/XL
database without requiring programming. You can use QUERY/V
interactively.
TurboIMAGE/XL components are:
* DBSCHEMA, a subprogram that creates a root file.
* DBUTIL, a subprogram that you can use to create, purge, or report
on a database, erase data from data sets, and enable and disable
logging and recovery options.
* TurboIMAGE/XL procedures, a set of library routines that allow
loading, accessing, and manipulating of data in a database.
Creating a Schema
You can use DBSCHEMA to create a root file containing the structural
definition of a database by using a schema. A schema analyzes data and
formalizes data relationships. The schema is a summary of all the data
relationships in a data base and stored as a separate text file. The
format used in a schema is TurboIMAGE/XL's database description language.
You can enter schema information in an MPE/iX text file, following the
database description language format. Schema information includes:
* Password and user class
* Designation of read/write capability for data sets
* Data items
* Designation of read/write capabilities for data items
* Manual master set
* Automatic master set
* Detail set
* Paths from master sets to detail sets
* Key items, identified by path counts
* Capacity for each set (specification of a prime number is
recommended for a master set)
Creating a Root File.
Once you have created a schema in an MPE/iX text file, you can use the
schema processor, DBSCHEMA, to create a root file and store in it an
internal description of the database, based on the schema in the text
file. The root file is part of a database and contains all the database
structural information required by TurboIMAGE/XL and QUERY/V.
The syntax for the command to run the schema processor is:
:RUN DBSCHEMA.PUB.SYS;PARM=n
where:
if PARM= is omitted, the formal designator for the input file,
DBSTEXT, is equated to $STDLIST. You would use this option, for
example, if you wanted to enter the schema directly from your
terminal during a session and list the output to your terminal (in
addition to creating a root file).
PARM=1 if DBSTEXT has been equated to an actual file designator
PARM=2 if DBSLIST has been equated to an actual file designator
PARM=3 if both DBSTEXT and DBSLIST have been equated to actual
file designators
Figure 7-5 shows an example of creating a root file. In this case,
both DBSTEXT and DBSLIST are equated to actual file designators: DBSTEXT
is an existing MPE/iX text file and DBSLIST is the line printer.
Figure 7-5. Example of Creating a Root File
DBUTIL
DBUTIL is a TurboIMAGE/XL subprogram that has many capabilities. You can
use it to:
* Create a database
* Purge a database
* Erase a data set
* Display information about a database
* Enable and disable logging and recovery options
* Activate, deactivate, and report on a database access file
You must be the creator of the database or know its maintenance word to
use the DBUTIL commands PURGE and ERASE. The maintenance word is an
optional ASCII string that you can specify with the DBUTIL commands
CREATE or SET. It defines a password to use for executing DBUTIL
commands, such as PURGE and ERASE, and to operate other database
procedures. If no maintenance word is defined, then only the database
creator can operate them.
The DBUTIL command PURGE purges the root file and all of the data sets in
the database. (You cannot use the MPE/iX command :PURGE to purge a root
file, detail set, or master set.
TurboIMAGE/XL has a transaction logging and recovery system with the
capability of recovering a database from a transaction-oriented log file
in the event of a system failure. DBUTIL allows you to enable or disable
these options.
Creating a Data Base.
Once you have created a root file, you can use DBUTIL to create the
database described in the root file. To create the database, you must be
logged onto the system with the same log-on used to create the root file.
DBUTIL creates data sets according to the specifications in the internal
description of the schema. When created, data sets are initialized to
zero and contain no data.
Figure 7-5 shows an example of creating a database. In this case,
the manual master set, CUSTOMER, has a primary key item named ACCOUNT
pointing to the detail set SALES. The automatic master set, DATE-MASTER,
has a primary key item named DATE that also points to the detail set
SALES.
Figure 7-6. Creating a Data Base
TurboIMAGE/XL Procedures
TurboIMAGE/XL procedures are a set of library routines that allow you to
load, access, and manipulate data in the database. You can call them
from HP C/iX, COBOL II/XL, HP FORTRAN 77/iX, and HP Pascal/iX application
programs.
You must be the creator of the database or know its database password
word to use TurboIMAGE/XL procedures. (The database password is an
optional ASCII string that you can specify with the DBUTIL commands
CREATE or SET. It defines a password to use for executing TurboIMAGE/XL
procedures and DBUTIL commands, such as as PURGE and ERASE. If no
database password is defined, then only the database creator can operate
them.) The database creator can use a semicolon (;) as a database
password to bypass all internal database security. You need not be
logged onto the same group and account that contains the database root
file and the data sets. You can perform these procedures on a remote
database. TurboIMAGE/XL procedures are in the following categories:
* Database access
DBOPEN
DBCLOSE
DBLOCK
DBUNLOCK
DBCONTROL
* Access data
DBINFO
DBGET
DBPUT
DBUPDATE
DBDELETE
* Information and status
DBINFO
DBEXPLAIN
DBERROR
* Logging
DBBEGIN
DBMEMO
DBEND
TurboIMAGE/XL subprograms are used for storing and loading. You must be
the creator or know the maintenance password to use them and you must be
logged onto the account and group where the database resides. The
subprograms are:
DBSTORE
DBRESTOR
DBLOAD
DBUNLOAD
Backing Up or Restructuring a Data Base.
DBSTORE and DBRESTOR copy a database to and from magnetic tape or serial
disc. They copy the entire database, including the root file. You can
use DBUNLOAD and DBLOAD to assist in restructuring a database, but they
copy only data, not the root file or the data set structures.
Changing an Existing Data Base Design.
You can change the design of an existing database without writing special
programs to transfer data from the old one to the new one. To
restructure a database, follow these steps:
1. Run DBUNLOAD, specifying the old database.
2. Use the DBUTIL command PURGE to purge the old database.
3. Redefine the database using the same database name and use
DBSCHEMA to create a new root file.
4. Use the DBUTIL command CREATE to create and initialize the new
data sets.
5. Run DBLOAD on the new database to put the old data into it.
For detailed information on the types of design changes you can make
using this method, refer to TurboIMAGE/XL Reference Manual (30391-90050).
Recovering a Data Base.
TurboIMAGE/XL is designed to maintain the integrity of its data bases.
However, it is possible that data or structural information can be lost
during a hardware failure or an operating system crash. It is highly
recommended that you regularly backup a database.
You can maintain the database by copying it to magnetic tape using
DBSTORE at regular intervals. If necessary, you can restore the database
using DBRESTOR. This restores the database to its state at the time it
was last stored. You can use this method more often than system backups
are done to maintain recent copies of the database and minimize the
number of transactions that may be lost.
To recover changes made after the last backup, you must do one of the
following:
* Rerun all jobs that modified the database since the last time it
was stored.
* If transaction logging was enabled, run the DBRECOV utility.
You can execute the transaction logging and recovery system to return a
database to a state near that at the time of system failure. The logging
system provides a mechanism to log database transactions to a logfile on
magnetic tape or disc. If you must restore the database, first restore
the backup data base copy and then run the recovery program, DBRECOV.
This re-enters transactions from the log file against the data base. It
also allows you to create individual user recovery files, providing
information to users that enables them to figure out where to resume
transactions.
The database administrator is responsible for enabling and disabling the
logging and recovery processes and generating backup database copies.
This makes logging a global function controlled at the database level,
rather than at the individual user level.
MPE/iX 5.0 Documentation