Dictionaries, Data Sections and Indexes
This section discusses the purpose and contents of the four levels in the database hierarchy.
SYSTEM Dictionary
The dictionary-only file called SYSTEM is the highest level file on the database holding all the information necessary to enable users to logon and access accounts on the database. In particular, it contains items which define the accounts that can be logged to. It also contains a LOGON item which provides the 'Logon please' message. During normal use of a database, a user is not aware of the SYSTEM dictionary. Access to SYSTEM is only available from the SYSMAN account.
Three types of definition item are held in the SYSTEM dictionary. They are:
- Account Definition Items (also called D-pointers because they have a 'D' in their first attribute). These define the accounts on the database. Each definition item contains information describing the location of the account's MD and defining the security restrictions applied to users of the account, such as password, default update and retrieval lock codes and maximum system privilege level.
- Synonym Account Definition Items (a type of Q-pointer since they have a 'Q' in their first attribute). These define account synonym names. The synonym account definition item points to an account definition item (D-pointer). The MD of the named account is then used by the synonym account. A synonym account, therefore, has the same files and commands as the named account, but a different name, and may have different security restrictions.
-
Remote Account Definition Items (also called R-pointers because they have an 'R' in their first attribute). These define accounts on another database, either on the same, or another, system.
A remote account definition item points to an entry in the
. This in turn contains the path to another database either on the same system or on a remote system. This enables users to logon to an account on any remote database, subject to having security clearance and the necessary communications facilities.
Creating an Account
A new account is created by executing theCREATE-ACCOUNT command. This prompts for the type of account required and creates the appropriate account definition item (D, Q, or R-pointer) in SYSTEM. It also prompts for other information such as security restrictions, modulo for the MD, and so on. This information is entered into attributes in the account definition item.
Logon Processing
The LOGON item in the SYSTEM dictionary contains the database name and a 'Logon please:' prompt. This is displayed as a prompt for the user to logon to the database. Refer to LOGON Processor.
Master Dictionaries
Master dictionaries (MDs) form the next level below the SYSTEM dictionary. Each account has one MD only which defines the files that are defined from that in the account and the commands, including, TCL commands, English commands, cataloged DataBasic programs and Procs which can be executed by account users. When you log on to a particular account the logon program is under the control of the MD for that account.
When a new account is created, Reality creates an MD and copies a standard set of definition items from a system file called NEWAC. The following types of definition item can be created in a master dictionary (MD):
- File Definition Items (D-pointers). These define files belonging to the account.
- File Synonym Definition Items (Q-pointers). These point to a file definition item in the database, enabling the user (subject to security restrictions) to access a file in another account or another database, or a file in the same account under a different file-name (synonym).
- Data Definition Items (formerly known as attribute definition items). Data definition items in the MD can be used as default definitions in English sentences.
- Command Definition Items. These point to the location of code for TCL commands, English commands, cataloged DataBasic programs and Procs, enabling account users to execute the commands.
- Command Synonym Definition Items. These point to another command definition, enabling the same command to be executed by entering a different name at TCL.
File Dictionaries
Just as an MD points to and defines all file dictionaries in an account, so each file dictionary points to one or more data sections and defines the format of the data in each. It also specifies any indexes associated with the file. To do this, a file dictionary may contain:
- Data Level Descriptors. These define the location of the file's data sections and any associated index sections.
-
Data Definition Items. These define the format of data in one or more data sections associated with the file dictionary and the type of processing required to generate an English report. Each item describes a single attribute in a data section, enabling the English processor to retrieve and display the data in a useful form.
A file dictionary can contain other items including data, but this is not normally the case. Inclusion of data items in a file dictionary makes the data more difficult to access as Reality looks for data definition items in the MD.
- Index Definition Items. These contain a compiled form of the selection and sort criteria which define an index structure. The item-id is the index name. An index definition item is created in the File Dictionary by executing the DEFINE-INDEX command. Note that it only defines the index structure, it does not create the index itself. See Defining an Index.
Data Sections
Data sections are the lowest level files of a database and contain the user data arranged in item format. One or more data sections may be associated with a file dictionary, or even no data sections. A file dictionary without data sections is referred to as a single-level dictionary. A data section is always accessed by way of its file dictionary, in which Reality looks for the data level descriptor to locate the data section.
Data sections can be shared between accounts using Q-pointers (file synonym definition items) in the MD and access to them can be restricted by update and retrieval lock codes. Q-pointers have already been discussed briefly in this section and are described in more detail in File and Item Structures. A user's capability to view or write data into a file is restricted by the update and retrieval lock codes of the target account or file definition item.
Index Sections
Index sections are closely coupled to the data sections that they are created for. An index section contains an entry for each item in its associated data section which matches the selection criteria in the index definition item. The D-pointer for the data section also defines the index section. Index entries are ordered according to their sort key value derived from the sort criteria in the index definition item. The construction and maintenance of an index section is transparent to the user. It is created using the CREATE-INDEX command with the index name (index definition item-id) as a parameter. Refer to File and File Index Management for a description of indexing.