USING COMMANDS TO DEFINE A DATABASE [ DICTIONARY 3000 ] MPE/iX 5.0 Documentation
DICTIONARY 3000
USING COMMANDS TO DEFINE A DATABASE
An IMAGE database can be defined in the Dictionary in two ways. For an
existing IMAGE database, use the Database Definition utility program
(DICTDBD) to transfer the database definitions from the database root
file to the Dictionary. Refer to Section V of this manual for
information on this utility.
The second way is to use the commands provided by the DICTDBM program.
The database and the data sets are created in the Dictionary as files.
The database is a BASE file; the manual master sets are MAST files; the
automatic master sets are AUTO files; and the detail sets are DETL files.
The data items in the database are created as elements in the Dictionary.
The definition for a database is completed by establishing the
relationship between the BASE file and the data sets. This relationship
is a hierarchical relationship and is defined using the RELATE command.
The elements are then added to the appropriate data sets with the ADD
command. (Refer to Section IV of this manual for a description of these
commands.) The hierarchical structure for a database is shown in Figure
3-1
______________________________________________________________________
| |
| |
| BASE <---- PARENT file |
| FILE |
| |
| | |
| --------------|-------------- |
| | | | |
| | | | |
| | | | |
| | | | |
| |
| MAST AUTO DETL <---- CHILD files|
| FILE ... FILE ... FILE ... |
| |
| | | | |
| | | | |
| | | | |
| | | | |
| |
| data data data |
| elements ... element elements ... |
| |
______________________________________________________________________
Figure 3-1. Summary of Hierarchical Structure for a Database
The BASE file is the top of the structure and is the PARENT file. The
data sets are related to the BASE file and are CHILD files. In this
structure, the PARENT file cannot have data elements directly associated
with it. The following description outlines the steps involved when you
use the DICTDBM commands to define a database. A complete description,
including examples for all the commands is given in Section IV of this
manual.
Creating Elements and Files for a Database
An element or a file must be defined in the Dictionary before it can be
associated or related to another entry. The CREATE command is used to
define an entry for a data element or a file.
Either the command string CREATE ELEMENT or CREATE FILE is used to create
the entry in the Dictionary. The name for the element or the file must
be unique. Use the REPEAT option before the command string to create
definitions for more than one element or file without having to repeat
the command. An entry for the BASE file must be created later to
establish the hierarchical relationship between the data sets and the
database.
If you are defining an IMAGE database, the IMAGE/3000 rules for defining
a master data set and a detail data set apply. For example, if the data
set is a detail set, you must indicate which data elements are the search
items, the name of the master set each search item is related to, the
data set's capacity and so forth.
After the entries are created, they may be displayed by the LIST or
DISPLAY commands. If you want to delete the entry, use the PURGE
command. If you want to change the entry, use the MODIFY command or the
RENAME command.
The RELATE ELEMENT command string can be used to define CHILD elements
(fields) within a PARENT data element. This allows access to parts of a
larger data element. For example, in the case of an IMAGE database which
contains a compound data item, CHILD elements can be used to provide
access to the sub-items of the compound item. To do so, respond to the
BYTE POSITION prompt by specifying the starting location of the sub-item
within the compound item.
Relating Data Sets to a BASE File
The hierarchical relationship between the data sets and the BASE file is
established with the RELATE command. The command string RELATE FILE is
used to define this relationship. This command allows for more than one
data set to be related to a BASE file during the command cycle. If
relationships for more than one database are to be established, use the
REPEAT option with the command string.
Relationship entries can be displayed by using the SHOW command. All the
data sets and, optionally, all the data elements associated with the set,
are displayed for a BASE file. For a data set, the elements directly
associated with it are displayed. The elements are displayed in the
physical order of their association with the file. The SHOW command
indicates key elements with an asterisk, identifies the chain paths, and
much more. The REPORT command displays an alphabetical list of the
elements associated with a data set, or an alphabetized schema-type
listing of elements for a database file.
You can delete the relationship entry with the REMOVE command and change
the entry with the CHANGE command. The REORDER command is used to change
the physical order in which the files are related to the BASE file.
Adding Data Elements to Data Sets
The ADD command is used to associate the data elements with the data
sets. Use the command string ADD FILE to define this association. An
entry is defined that associates an element with a data set. Elements
may not be associated with a BASE file directly. DICTDBM will not accept
such an entry and will issue an error message.
To display the association entries, use either the REPORT or SHOW
commands. The SHOW command uses an asterisk to indicate which element is
the key element in the file and to display the elements in the order in
which they are associated with the file.
To delete an association entry, use the DELETE command. To change an
association entry, use the UPDATE command. To change the physical order
in which the elements are associated to the data set, use the RESEQUENCE
command.
Securing a Database
The security that may be defined is the same security defined for an
IMAGE database. IMAGE allows the database designer to control access to
specific data sets and data items by defining up to 63 user classes. The
classes are associated with data sets and data items in read or write
class lists. This association determines which user classes may access
which data elements and the type of access that is granted. For a
complete description of how to protect an IMAGE database, see the
IMAGE/3000 Reference Manual.
In the Dictionary, user security classes are identified by an integer
from 0 through 9999 and are associated with a password defined by the
database designer. Each security class number is unique and can be
created only once.
When the Dictionary/3000 Database Creation utility program (DICTDBC) is
used to create the database, the security class numbers are reassigned by
the utility to conform to the numbering scheme used in IMAGE. The CREATE
command must be used to define a user security class entry. You use the
command string CREATE CLASS for this entry. During the command cycle,
the prompt RESTRICT CLASS TO A FILE (N/Y) is issued which allows you to
restrict the use of the class to a particular database. You may choose
to respond Y to this prompt if the sets and elements you will add to this
class belong to more than one database but you want DICTDBC to include
this class in the schema of only one database. When DICTDBC retrieves
the security classes associated with the sets and elements of a database
for which it is to generate a schema, it will skip those classes
restricted to another database.
After creating user security classes, either the LIST or DISPLAY command
can be used to display the entry. If you want to delete an entry from
the Dictionary, use the PURGE command. To change the entry, use either
the MODIFY command or the RENAME command.
The association between the security classes and the data sets or the
elements is established using either the SECURE or ADD command. The
SECURE FILE and ADD CLASS command strings allow you to specify protection
at the element level, while ADD CLASS-FILE specifies protection at the
file level.
SECURE FILE is used to specify protection that applies to all the data
elements in the file. In this way, it is similar to using repeated ADD
CLASS command strings. SECURE FILE can also be used to specify
protection for the file itself.
Creating a Database
The Database Creation utility program (DICTDBC) can be used to create a
schema file and a root file from the definition in the Dictionary. Note
that the definition, associations, and relationships must already be
defined in the Dictionary to use this utility. See Section V of this
manual for a detailed description of this utility.
MPE/iX 5.0 Documentation