The GLIDER system can import, update, and export files generated by a data base system (DBASE IV in this implementation). A data base file is a succession of records, each with a set of fields. All the records in a file have the same structure. The records usually describe the characteristics of individuals of a set (people, objects, years, cities, etc.) by means of the values of the fields. These are simple tables.
DBASE file in order to be suitable for GLIDER processing must have as its first field in its record structure a primary key field named with the same file or table name.
Association tables are used when the values of a relation of two (or more) sets have to be described. For each combination set of two (or more) individuals, one of each set, there is an entry in the table that describes, by one or more fields, the characteristics of the relation. In the actual version only complete tables can be imported, i.e., all the possible combinations of records in the associated tables must appear. In an association table of N simple tables the names of these tables must appear as the first N fields in each record, conforming the primary key of the association.
The user must give in a DBTABLES declaration, the names of the tables
and the association indicator (i.e., how many simple tables are associated
in the declared table).
The declarations have DBTABLES as a heading, followed by one or more
declarations:
<table name> : <association indicator>
These declarations must be separated by commas and each or some groups of them may be delimited by ( ). The groups are also separated by commas.
<table name>
is a name of an existing DBASE file optionally
preceded with directory path.
<association indicator>
is a number from 1 to 5. If omitted, 1 is
assumed (simple table).
The declarations that are in a group within ( ) are assumed to have the same structure.
Example:
DBTABLES (GroupP1, GroupP2), (Goods), (ConsPatt: 2, CPat1: 2);Declares two simple tables:
GroupP1, GroupP2
of the same structure,
a simple table Goods
of different structure and two tables that are
association of two tables and have the same structure. The two
first fields of ConsPatt
must have as name the name of the two
simple tables that ConsPatt
associates. Such simple tables must
have been declared before.All the declared tables must exist as DBASE tables. The compiler uses information from these tables. If they are in other directory the table names must include the path. To handle these tables the GLIDER system provides the instructions: LOAD, UNLOAD (see 6.14, 6.29), and UPDATE (see 7.26).
The system declares the following variables:
N_<table name>
is an integer whose value is the number of
records of the table.
NOM_<name of a simple table>
is a constant
array of N_<name>
elements that contains the values (usually key names) of the first field
of the table.
For each table integer constants are declared with the names in the
first field and successive values 1, 2, 3 ... N_<name>
. They are
useful in the program to refer to records by name.
The types of the fields may be: REAL, INTEGER, STRING or BOOLEAN.
Example:
DBTABLES ( \Pop\Group), ( \Econ\Goods), ( \Modat\ConsPatt: 2, \Modat\Consp: 2);The file
Group
in the directory Pop
may be:
Fields Group Size Income Savings EmplFrac Records 1 Entrep1 20000 4275000.00 870000.00 1.00 2 Entrep2 300000 1875000.00 322000.00 0.98 3 Entrep3 850000 975000.00 52000.00 0.97 4 Worker1 560000 675000.00 5000.00 0.92 . ..................................... .... 9 SelfEmp 130000 52500.00 10000.00 0.72This table contains some characteristics of different population groups.
The system generates the constants N_Group
(value 9) and the
array NOM_Group
(values 'Entrep1', 'Entrep2', .. , 'SelfEmp'
).
The constants Entrep1 = 1, Entrep2 = 2,.., SelfEmp = 9
are also
defined.
An array of length 9 is dynamically allocated in memory at run time for
each field. The instruction LOAD
imports the data from the
file table. So the
instruction:
LOAD(Group, Size, Income);loads the record values of the table
Group
into the system
created arrays
Size
and Income
. So,
Income[Worker1]
= 675000
. The model program can now
use and change the values of these array.
The instruction DBUPDATE
can pass these modified data to the
original file or to other file with the same structure. When the
values are no longer needed in the simulation they can be discarded
by an UNLOAD
instruction and the memory they used is freed.
If the table Goods
have the following fields and values:
Fields Goods Production PrizeIndex Records 1 Housing 380000 1.10 2 Food 7850000 1.05 3 Clothing 56000 1.20 . ... ... ... 7 Health 22400 1.32 8 Education 837000 1.22Then the system generates
N_Goods = 8;
NOM_Goods = 'Housing',
'Food'
, etc. and the
constants: Housing = 1
, Food = 2,
etc.
This table contains some characteristics of certain goods.
The table ConsPatt
will describe the consumption pattern of the
population groups indicating how much each group consumes of
each good. One part of this table may be:
Fields Group Goods Consumpt Priority Records 1 Entrep1 Housing 150400 8 2 Entrep1 Food 250100 5 3 Entrep1 Clothing 170000 5 . ... ... ... . 7 Entrep1 Health 230000 7 8 Entrep1 Education 296000 8 9 Entrep2 Housing 75000 7 10 Entrep2 Food 92000 6 11 Entrep2 Clothing 80600 5 . ... ... ... . 15 Entrep2 Health 119000 7 16 Entrep2 Education 104000 7 . ... ... ... . 65 SelfEmp Housing 2500 5 66 SelfEmp Food 3060 8 67 SelfEmp Clothing 1200 6 . ... ... ... . 71 SelfEmp Health 1350 6 72 SelfEmp Education 1095 7When this table is loaded the system passes the values to an array called
ConsPatt
with two indexes and sizes of 9 rows and 8 columns.
So, ConsPatt[Entrep2, Food] = 92000
.