#

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

Program | Program Description
checkndx | This program checks an NDX file
copydbf | This program copies a DBF file structure
deletall | This program marks all records in a DBF file for deletion
dumphdr | This program opens an Xbase file and prints its header
dumprecs | This program dumps records for an X-Base file
packdbf | This program packs a database file
reindex | This program rebuilds an index
sample1 | This program creates an Xbase file MYFILE.DBF
sample2 | This program populates file MYFILE.DBF created by program sample1
sample3 | This program lists MYFILE.DBF data populated by program sample2
sample4 | This program deletes records, undeletes records, locks and packs datafile MYFILE.DBF
sample5 | This program demonstrates NDX class usage
testdate | This program tests the Xbase date methods
testhtml | This program tests the Xbase HTML methods
testhtml.html | This form works with the testhtml program
undelall | This program undeletes all deleted records in a dbf file
zap | This program removes all records from a DBF file
Makefile | Makefile 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

  Program | Program Description
  creatzip | This program creates the zipcode files
  loadzips | This program loads the zipcode files
  dumpzips | This program dumps zipcodes by city
  zipinit | This program updates the stats and requests query information via HTML (fow web browser)
  zipinq | This program queries the zip database and generates a list of results via HTML (for web browser)
  Makefile | Makefile for building sample programs

  ### Xbase Zipcode Sample Databases and Indexes

  File | Description
  ZIPCODES.DBF | Database of zipcodes, city and states
  CITY.NDX | Index of zipcode file by city
  ZIPCODE.NDX | Index of zipcode file by zipcode
  ZIPSTATS.DBF | Maintains 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