Sample Programs

Page Updated 2/1/99


Sample Xbase DBMS programs are located in the xbase/samples and xbase/bin directories.

X-Base Sample Programs

ProgramProgram Description
checkndxThis program checks an NDX file
copydbfThis program copies a DBF file structure
deletallThis program marks all records in a DBF file for deletion
dumphdrThis program opens an Xbase file and prints its header
dumprecsThis program dumps records for an X-Base file
packdbfThis program packs a database file
reindexThis program rebuilds an index
sample1This program creates an Xbase file MYFILE.DBF
sample2This program populates file MYFILE.DBF created by program sample1
sample3This program lists MYFILE.DBF data populated by program sample2
sample4This program deletes records, undeletes records, locks and packs datafile MYFILE.DBF
sample5This program demonstrates NDX class usage
testdateThis program tests the Xbase date methods
testhtmlThis program tests the Xbase HTML methods
testhtml.htmlThis form works with the testhtml program
undelallThis program undeletes all deleted records in a dbf file
zapThis program removes all records from a DBF file
MakefileMakefile for building sample programs



Sample Application

A sample application has been developed to demonstrate the basic functions of the Xbase library. The application is a basic utility for querying zipcodes and determining a zip code for a given city, or a city for a given zip code. Although a simple application, it demonstrates the following basic Xbase functions:

  • A) How to create databases and indices
  • B) How to populate the databases with data
  • C) How to query the databases and extract information
  • D) How to generate HTML code for displaying the data in a web browser


    The following data flow diagram shows the basic design of this application, what the programs are and do, and how the databases are accessed.




    Xbase Zipcode Sample Programs

    ProgramProgram Description
    creatzipThis program creates the zipcode files
    loadzipsThis program loads the zipcode files
    dumpzipsThis program dumps zipcodes by city
    zipinitThis program updates the stats and requests
    query information via HTML (fow web browser)
    zipinqThis program queries the zip database and
    generates a list of results via HTML (for web browser)
    MakefileMakefile for building sample programs



    Xbase Zipcode Sample Databases and Indexes

    FileDescription
    ZIPCODES.DBFDatabase of zipcodes, city and states
    CITY.NDXIndex of zipcode file by city
    ZIPCODE.NDXIndex of zipcode file by zipcode
    ZIPSTATS.DBFMaintains number of visitors and inquiries


    Testdrive the zipcode application

    Download the zipcode application

    To use the zipcode application, perform the following steps after you download it.

  • cd /usr/xbase
  • mkdir zipcodes
  • cp /home/of/zipcodes.tar.gz /usr/xbase/zipcodes
  • unzip zipcodes.tar.gz
  • tar -xvf zipcodes.tar
  • Enjoy!!
    Send me mail - xbase@startech.keller.tx.us

    (c)1997 StarTech