URL: http://www.firstbasesoftware.com/man/man1/dbdbas.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[ Index of Contents] [ FirstBase RDBMS Overview]


NAME

dbdbas - define a FirstBase database dictionary

SYNOPSIS

dbdbas [-d database]

DESCRIPTION

Dbdbas allows definition and modification of a FirstBase database dictionary. This dictionary will be used by dbedit(1) to create and maintain the actual database. Furthermore, virtually every program in the FirstBase system reads this dictionary to determine the size and shape of the database it is working on.

A database dictionary consists of a series of field descriptors. Each field descriptor contains at least three field attributes: field_name, field_type, and field_size. These and optional field attributes are described below.

Dbdbas(1) allows creation and deletion of field descriptors, as well as modification of field attributes without disturbing attributes already in place. The overall effect is a database-dictionary screen editor complete with an auto add mode, as well as insert and delete capabilities.

A list of simple editor commands appears on the 24th line of the screen at all times, with the standard help signal offering a longer summary of possible commands. Complete interactive error checking is done on the contents of all attributes.

The following is a list of all field attributes and their purpose:

name
gives a label to a field. This label or field name appears on all screens involving the corresponding field, and is also used to match indexes with FirstBase generator requests, etc. Unique naming is enforced (i.e. it is an error for two fields to have the same label as their names). The name needs to be alphanumeric also, although blanks are allowed.

type
provides the type code of the field. Valid types are:

a - alphanumeric
b - binary
A - alpha
c - choice
C - choice (no screen display)
d - date
f - floating point
F - Formula (virtual)
L - Link (to another database)
n - numeric
N - positive numeric (>= 0)
U - Uppercase. (Alphanumeric).
X - Extended Choice/Help.
$ - dollar

Input into the described field (using dbedit) will be checked according to the value of this field attribute. Note that binary fields can only be manipulated through the use of the FirstBase Library routines fetch(3) and store(3).

For more details on the behavior of each of these field types, see the chapter on dbedit in the FirstBase User's Guide and Reference Manual.

size
maximum size of the field. This size is limited only by the hardware.

default
characters that match the type of the field that are used in case of user default when editing the field (using dbedit(1)). If no default attribute is defined, the field is given *forced entry* status. If blanks are used as the default, this is redisplayed as a single '_' (underscore) for visibility.

Special meta-defaults that allow softer, less rigid defaults are:

$AUTODATE
is not really a true default, just an aid. AUTODATE is used for large text fields that are intended to be used as note collection places, i.e. for phone logs or meeting notes. When a long field is edited using the visual editor, dbvedit(1) will concatenate the current date and time to the end of the field before the user gets it.

$AUTOINCR
consults the pre defined auto index to determine the last number in use. This number is incremented and used when writing the current record. Until that time, a * marker is used. (The marker is used in case the record is aborted without being saved).

Remember: the field using this auto increment feature MUST be auto indexed. Auto increments work in a multi-user environment. Also, there is an environment variable, FORCEAUTOINCR, that can be used to alleviate the need for the <RETURN> during editing of these fields.

Additionally, for ensured proper behavior, fields using the automatic increment function should be locked (see lock below) so that the increment key is not overwritten (inadvertently).

$DATE
defaults to current date.

$INCR
defaults to 'previous entry plus one'.

$MINUS
defaults to current entry for the field, minus one.

$MTIME
defaults to the current (military) time. Format is HH:MM:SS.

$NPREV
defaults to negative of previous entry for that field.

$PLUS
defaults to current entry for the field, plus one.

$PREV
defaults to previous entry for that field.

$TIME
defaults to the current time. Format is HH:MM.

$USER
defaults to the name of the user.


Note: all database fields have their own increment and previous areas that are used for $INCR and $PREV.

In the case of a formula field, the default input is specialized to achieve formula input. Formulas use numbers to represent fields (i.e. 16 for field 16) and a prepended 'C' or 'c' for constants (i.e. C4.5 for 4.5). Addition (+), subtraction (-), multiplication (*), and division (/) are allowed as operators.

Note: Only dollar, float, numeric and positive numeric fields can be used in formula calculations. This means references to other formulas will not work. Also, all formulas read from left to right, and there is no precedence among the operators.

The precision of a formula is specified by appending a colon (:) to the formula followed by a number. Default precision is two.

For example, if field 5 is hours and field 16 is days, then 5*C4.5:2 would specify a field that would show the pay due to anyone working at $4.50 per hour. And 5/16:6 would show the average number of hours worked per day, carried out to six (6) decimal places.

All formula entries are parsed to determine whether the formula is valid at that moment, with interactive error messages to help debug long formulas. This means re-editing of a formula may be necessary if it has forward references in it. (A forward reference is a reference to a field not yet defined).

Note: these basic formulas are subsumed by the macro field feature. If this simplistic formula entry described here is inadequate, use a macro field to provide a more complex default. See the description of macro files below, and the manual page macro(5).

In the case of a link field, the default input is specialized to handle a link address. Link addresses contain four parts or components, with each component separated by an exclamation point.

An entire link address looks something like

local-field!link-index!link-dbase!far-field

where local-field is in the current database, link-index and link-dbase are an actual FirstBase index/database pair, and the far-field is in the link-dbase. The following is a list of each component and its meaning:

local-field
The first link address component is a field name that designates a Link Cross Reference Field Value, a field from the current database that will be used to locate the linked record in the far (linked) database.

link-index
The far index that is searched to locate the value indicated by the Link Cross Reference Field Value.

link-dbase
The database where the actual linked record exists. The record number found in the link-index is used to extract a record from this far database.

far-field
The last link address component is a field name that designates the actual Link Field Value from the far database. This field name points to the field that will be available in the current database, but is actually stored in the far (link) database.


There is also a link method that allows pointing to absolute records. In this case, although a link-index value is listed in the link formula, the link index is ignored, and the absolute record number indicated is used as the link record.

The entire link address using this feature looks like

R@local-field!link-index!link-dbase!far-field

where R is the absolute record number of the link record. Note that these link values will appear on dbedit(1) and dbvedit(1) screen pages even in Command Level.

comment
words or characters that can appear on the screen with the field whenever that field is edited (using dbedit(1)). Note: the length of a comment plus the length of the corresponding field must fit into the dbedit(1) display window (50 characters wide). Comments have no meaning for fields larger than this window size.

comment location
specifies whether user defined screen comment appears (b)efore or (a)fter the edit-field space.

lock
allows locking of a field. If set to y(es), the field may not be edited after initial input. Otherwise, it is set to n(o).

help
allows the specification of a file that is bound to that field. The contents of this file are available to the user in many programs through the ?N help mechanism where N represents the number of the field. Dbedit(1) also allows this file to be displayed upon receiving the standard help signal (<CTL>-H) during the input process for that field.

choice
allows the specification of a file that will be used as the choice input definitions for a field in the database. Note that if there is a choice file, the only way to tie in a different helpfile is by using the $HELP directive within the actual choicefile.

The choice file is only allowed for a field defined to be of type choice. See choice(5) for a definition of the choice file layout. In addition, the AddChoice option flag can be set so users can add new selections to a choicefile (for future use).

extended choice
allows the specification of a file that will be used as the extended choice file, a dictionary file of sorts that is used during extended choice selections. Note that if there is an extended choice file, there is no help nor choice file. The extended choice file is only allowed for a field defined to be of type extended choice. See xchoice(5) for a definition of the extended choice file layout.

autoindex
indicates to FirstBase that an index for this field is to be maintained by dbedit. The index name must be unique among the other autoindex names, and will only be used for tracking all of the entries in the database by the indicated field. This means that all aspects of index maintenance can be automated for this index.

An autoindex can also be defined to only allow unique entries into the field during use of dbedit(1). For example, if a field for an account number was being autoindexed with the unique entry option set, then you could not enter two account number 101's into the dbase.

NOTE: A better method for defining autoindex fields is available using a *.auto file. See autoindex(5).

range
allows the specification of a valid range for fields values. All ranges are of the form 'xxx-yyy' where xxx is the low end of the range and yyy is the high end. Ranges work with any field, but date fields must define the range using YYMMDD format.

Ranges can also be defined using comma separated fields of accepted values. In other words, the range 'y,n' will only accept a 'y' or an 'n'. Any number of comma separated values can be used.

macro
allows the specification of a macro file that will be used in place of the normal editing of this field during the use of the database editor dbvedit(1). (Again: this works for dbvedit(1) only!)

The macro file specified can assign a default string or value to the field, or can provide the entrance to conditional editing of other fields. The contents of the current record can be tested, additional input can be requested, or complex functions can be generated.

A full description of macro files is in macro(5).

Per normal FirstBase programs, the user is given a chance to change and modify data on the screen via the standard 'any change' screen. This prompt is displayed at the bottom of the screen and the program awaits interactive commands. The following is a list of valid dbdbas(1) commands:

<CTL>-H
displays a summary of these commands.

?[dfhiN]
displays help on the database, formulas, user defined help files, index, or field N.

<RETURN>
(return, or enter) pages forward one page in the database dictionary. Wrapping occurs at end of file.

@
go into auto add mode. Note that once a database has data in it, only Formula and Link type fields can be added.

#
allow changes to line number #.

-
standard END key -- exits program and keeps all changes.

<CTL>-X
aborts the program. The effect is to exit without overwriting the file, meaning all modifications are lost.

b
pages backward one page in the database dictionary. Wrapping occurs at beginning of file.

d
delete function. Allows deletion of a single dictionary entry. All entries below deleted entry slide up one slot.

i
insert function. Inserts a standard dictionary entry before any given field. All entries below inserted entry slide down one slot.

NOTE: in the FirstBase database dictionary some file names are used to specify other data objects: helpfiles, choicefiles, auto indexes, and database link files. When a FirstBase tool is invoked, if the working database is in a different directory, these file names are expanded to reflect the working directory. File names beginning with a dot (.) or a slash (/) will not be expanded.

FILES

dbase
default name of FirstBase database

*.ddict
dictionary for database.

*.cdb
database.

*.map
record map of FirstBase database.

SEE ALSO

dbedit(1), dbcgen(1), choice(5), ddict(5), defaults(5), input(5), macro(5), screens(5), setup(5), xchoice(5)

FirstBase User's Guide and Reference Manual

DIAGNOSTICS

Dbdbas(1) will not allow structure modifications to a dictionary file if a database for that dictionary exists in the working directory. Modifications of defaults, index names, etc. are allowed whenever desired.


URL: http://www.firstbasesoftware.com/man/man1/dbdbas.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[ Index of Contents] [ FirstBase RDBMS Overview]