Defining Tables
A flat-file database contains no underlying, native indexing
system (such as Oracle or SYBASE), and therefore, no structured
format. In data management systems that use flat files, the
TABLE statement in the environment catalog provides the information
that directs OmniAccess routines to physical files.
In flat-file data management systems, it is best to supply
a logical name for the TABLE name and to identify the physical
file in a PHYSICAL statement. Although you can declare a physical
file specification in the TABLE name, you would have to enter
the entire file specification whenever you referenced that
table through an OmniAccess application. Assigning a logical
name to TABLE and declaring the physical file in a PHYSICAL
statement is a more efficient means of accessing data in flat
files.
You can assign any logical name to TABLE, as long as you
adhere to the naming rules outlined above. It is best, however,
to supply a name that describes the data that is stored in
the file. For example, if a file contains information about
customers, name it "CUSTOMERS".
TABLE "CUSTOMERS"
PHYSICAL "c:\omnidex\demodata\customers.flat"
PARENT KEY "CUSTOMER_NO"
top
Defining COLUMNs
In data management systems that use flat files, declare a
logical name to identify a particular area (field) common
to records in the file you declared for TABLE. You can name
COLUMN anything, as long as you adhere to the naming rules
outlined in Defining TABLEs. It is best, however, to supply
a name that describes the data that is stored in that area
of the record. For example, if an area of each record in a
file (table) is reserved for an order number, you might define
the corresponding column as "ORDER_NO".
TABLE "ORDERS"
PHYSICAL "C:\omnidex\demodata\orders.flat"
CHILD KEY "CUSTOMER_NO" REFERENCES CUSTOMERS(CUSTOMER_NO)
CHILD KEY "PRODUCT_NO" REFERENCES PRODUCTS(PRODUCT_NO)
COLUMN "CUSTOMER_NO" DATATYPE INTEGER
LENGTH 4
COLUMN "PRODUCT_NO" DATATYPE CHAR LENGTH 12
COLUMN "ORDER_DATE" DATATYPE CHAR LENGTH 6
COLUMN "STATUS" DATATYPE CHAR LENGTH 4
COLUMN "QUANTITY" DATATYPE INTEGER LENGTH 4
COLUMN "AMOUNT" DATATYPE INTEGER LENGTH 4
top
|