Product Documentation

ODBC - c-tree Plus Edition

Previous Topic

Next Topic

Data Dictionary Creation - Import Method

The FairCom Data Dictionary can be created with the FairCom import utility, import.exe using a text-based script with the following layout:

DATABASE d_name

TABLE alias_name1(\path\file1_name1)

TABLE alias_name2(\path\file2_name2)

  • d_name is an arbitrary database name or view over the data files (i.e., FAIRCOM.DB is the database name used in the tutorial).
  • alias_name1 and alias_name2 are arbitrary names for the data files residing on disk (i.e., CUSTOMERS and ORDERS are sample alias names from the tutorial import script, SAMPLE.TXT).
  • path1 and path2 are either fully qualified paths or relative paths to the current logical drive (i.e., FAIRCOM\ODBC\32bit\SAMPLE from the tutorial import script, SAMPLE.TXT).
  • file_name1 and file_name2 are the actual file names residing on disk (i.e., CUSTMAST.DAT and CUSTORDR.DAT from SAMPLE.TXT).

The following example shows one database view (FAIRCOM.DB) and four file members (CUSTOMERS, ORDERS. ORDER_DETAIL, and ITEMS):

DATABASE FAIRCOM.DB

TABLE CUSTOMERS(c:\FAIRCOM\ODBC\32bit\sample\CUSTMAST.DAT)

TABLE ORDERS(c:\FAIRCOM\ODBC\32bit\sample\CUSTORDR.DAT)

TABLE ORDER_DETAIL(c:\FAIRCOM\ODBC\32bit\sample\ORDRITEM.DAT)

TABLE ITEMS(c:\FAIRCOM\ODBC\32bit\sample\ITEMMAST.DAT)

Previous Topic

Next Topic

Import Script

The import utility (import.exe) is a command line utility executed from the Windows command prompt. To create the dictionary for the ODBC tutorial, execute the import utility by specifying the path to import.exe located in the FAIRCOM\ODBC\32bit directory and pass the import script on the command line as follows:

C:\FAIRCOM\ODBC\32bit\import sample.txt

The Data Dictionary file, CTSYSCAT.FCS, is created in the root directory of your local drive. For example, if FAIRCOM\ODBC\32bit is installed on drive C, CTSYSCAT.FCS is created in the C:\ directory. Move this file to a new location by copying it to the desired location and specifying the path in the ODBC Setup dialog box. Each time the import utility is executed, any existing CTSYSCAT.FCS file in the root directory of the local drive is overwritten.

When building your own script, it is recommended to fully specify the file paths (i.e., include the logical drive letter in addition to the path, C:\FAIRCOM\ODBC\32bit\ as opposed to \FAIRCOM\ODBC\32bit\).

Previous Topic

Next Topic

Wildcard

Rather than building your own script, import.exe can be passed a wild card to build the script. Execute the import utility by specifying the path to import.exe located in the FAIRCOM\ODBC\32bit directory and pass -f *.dat as follows:

C:\FAIRCOM\ODBC\32bit\import -f *.dat

Passing -f *.dat tells import.exe to create the Data Dictionary (CTSYSCAT.FCS) and add all of the files with the “.dat” extension located in the current directory. When the import utility sees the -f switch, it also creates a text-based import file, IMPORT.TXT, listing all the data files located in the current directory. This script can be used by import.exe to re-create the dictionary.

Previous Topic

Next Topic

Multiple Database Script

As mentioned earlier, splitting application files into distinct database groups enhances performance of the ODBC Driver. This is easily done with import.exe.

Figure 5-2: Add New Database View over the Customer File

DATABASE FAIRCOM.DB

TABLE CUSTOMERS(c:\FAIRCOM\ODBC\32bit\sample\CUSTMAST.DAT)

TABLE ORDERS(c:\FAIRCOM\ODBC\32bit\sample\CUSTORDR.DAT)

TABLE ORDER_DETAIL(c:\FAIRCOM\ODBC\32bit\sample\ORDRITEM.DAT)

TABLE ITEMS(c:\FAIRCOM\ODBC\32bit\sample\ITEMMAST.DAT)

DATABASE CUSTOMER.DB

TABLE CUSTOMERS(c:\FAIRCOM\ODBC\32bit\sample\CUSTMAST.DAT)

The above illustrates adding a new database view (CUSTOMER.DB) over the Customer file (CUSTMAST.DAT). When this script is passed to import.exe, the data dictionary created contains two databases: FAIRCOM.DB with four data files; and CUSTOMER.DB with one data file. To switch between the databases, change the name specified in the Script Name setting in the ODBC Setup dialog.

TOCIndex