DATA DICTIONARY

DATA DICTIONARY

NAME

dict.dat – UNIBASE Data Dictionary


DESCRIPTION

The Data Dictionary contains all the tables or files known to UNIBASE as well as the relationship between tables and all the calculations or rules that may be applicable to each table.

The Data Dictionary is a text file named ‘dict.dat’. It must be in the current working directory where an application is to be run. It can be created or maintained using any text editor such as vi, ed.

Alternative Data Dictionaries can be used by setting the environment variable DICTIONARY to the name of the alternate Data Dictionary. Some commands also have an option -D for specifying a new Data Dictionary.

The Data Dictionary consists of a series of File Definitions separated by an arbitrary amount of comments. Comments are any text not within a table definition.

FORMAT OF A TABLE DEFINITION
<table def> ::=
<table name>
{<table help>}
<attribute def>
...
>
<key def>
...
>
{<association def>}
...
>
{<classification def>}
...
>
<table name> ::=
<simple name>|<alias name> {<arguments>}
<simple name> ::=
<local filename>
<alias name> ::=
<text>,<simple name>|<simple name>,<file name>
<attribute def> ::=
<name>,<width>>{*<dimension>}{<domain>{<domain info>}}
<help>
<key def> ::=
{<attribute>{,<key def>}}
<association def> ::=
{<assoc type>}<table>{<key def>}
<assoc type> ::=
+|-|=|*
<classification def> ::=
<expression>

A field specification consists of:

  • Field Name followed by a ‘,’
  • Field Width in characters
  • An optional “*” and the number of array elements
  • Field Type

e.g.

stock no,	10	PX
prices,		10*7	N2

A field specification may be followed immediately by a help message. e.g.

name,	30	PX
#CUSTOMER NAME
#        CUSTOMER NAME
#        -------------
#
#Enter the customer name. It is 30 characters
#wide and will be conerted to upper case as you type.

The field definitions from another table can be included at any place by using a line starting with ‘<‘ followed by the name of the table e.g.

<stockcalc

Arguments to be substituted in the included table can be placed on the include line after the table name. Each argument is separated from the others by a space or a tab. Arguments containing spaces can be used by surrounding them with ” ” e.g.

discount,	5	E2	[price] * %1

Help messages can be attached to a table or a field by using lines starting with a ‘#’. These must be immediately after the thing they describe e.g. Table help message are located on the lines immediately following the table name. Field help is on the lines immediately following the field definition. See help (4) for details of help message layout.

A key definition is simply a list of fields separated by a comma. There may be as many keys defined for as many files as you like. To designate a key as unique, the first character of the key definition must be an ‘*’.

An empty key definition is valid. In this case the records are stored in order of addition to the table or in a specified position using the INSERT option of ubmulti.

This is particularly useful for view text, or other files where the relative position of the table records must be preserved.

The general form of an association is

{<assoc type>}<table>{<key  def>}

where

<table>

is the table being joined to or associated with, and there is an optional list of comma separated fields to be used in the association.

The four special kinds of association are indicated by the association type:

TABLE ASSOCIATIONS
+ Associate on first record only.
Associate on last record only.
= Records in the association track the original record. In this case if any field used in the association is changed, the change is reflected in the associated table. If the associating record is deleted, the associated records WILL NOT BE deleted.
* Records in the association are owned by the associating table. In this case if any field used in the association is changed, the change is reflected in the associated table. If the associating record is deleted, the associated records WILL BE deleted.

IMPORTANT: Only one special association type can be used per association.

Note that any <field> in <key def> may specify a field from another table by using the form <table>.<field>. e.g.

prices	stock no,customer.price

<key def> is optional and the association will be to all records in the associated table if <key def> is omitted.

It is legal to associate a table to itself by using an alias to the associating table. It is also legal for the associations to be recursive. Both the screen and report programs do sensible things with recursive associations. In particular recursive associations can be used for bill of material type applications.

It is also legal for an association to be on a partial key.

The general form of the class definition is a list of expressions. Each expression must be true (non-zero) for a record to be included in a class.


DEFAULT ATTRIBUTES

Every table has the following attributes supplied by UNIBASE:

no of recs counts the number of records 1 for each record, but is summed for subtotals and aggregation.
_record the stored record. Note that dates are printed as stored YYMMDD.

SEE ALSO

help (4)
type (4) UNIBASE ATTRIBUTE (FIELD) TYPES