                Database Packer and Maintenance Utility (v4.0)
        Copyright (C), 1995-96, Maristream, Inc.; All Rights Reserved.

                               Maristream, Inc.
                             2015 Franklin Street
                          N. Little Rock, AR  72114
                               (501) 758-7482


DBPACK is a multi-function Windows 3.11 maintenance utility for FoxPro
2.X and other xBase type databases (.DBF's) and their index files (single
.IDX's, compound .CDX's, and independent .CDX's).  Functions available
through DBPACK include:

   1) Pack a database to remove deleted records, and reindex it if it
      has an index file or a combination of index files.  Normally,
      deleting a record in a database just sets the record's "deleted"
      flag, and doesn't actually remove the record from the database.
   2) Reindex the database without packing it, to handle situations
      where the indexes have gotten out of sync with the data.  (This
      is different from rebuilding the indexes, which is done if the
      indexes are corrupt or missing.)
   3) Browse and, possibly, edit records in the database, including
      deleting and undeleting records individually or in mass, or,
      showing only the active records that aren't marked deleted.  The
      records can be shown either with one row per record, or with one
      row per field (with the record spread out over multiple lines).
   4) Search through and/or select subsets of records in the database
      to be shown, printed, or exported, after generating the AND/OR/
      NOT criteria set from popup menus of the fields and the 12 built-
      in comparisons, or by typing in your own criteria directly.
   5) Select subsets of fields to be shown, printed, or exported, by
      marking ("deleting") those other fields that are to be excluded.
   6) Browse the indexes and their modifiers for the database in a
      scrollable list, including fields or expressions being indexed,
      subset ranges, and descending and unique flags.
   7) Show individual indexes and their modifiers for the database on
      a single index tag description detail screen.  Single and inde-
      pendent compound index files can be closed individually here.
   8) Select an index to order the records by in the database during
      subsequent browses, printouts, or exports, or, clear the current
      order, which can be done from either the index browse list or
      the detail screen.
   9) Browse the structure of the database, showing field names, types,
      lengths, and decimal places, where applicable (marking fields to
      be excluded from subsequent browses, printouts, or exports here).
  10) Print the database records (all or subsets), database structure
      (field definitions), database indexes, and help file from their
      respective browse screens.
  11) Export the database, either all or a subset of records and/or
      fields, into any of 15 different file types.  Indexes will also
      be included for .DBF exports, where possible.
  12) Create an index description file (.DBI) for the database and
      rebuild the indexes from that file during subsequent sessions
      if they become corrupted or are deleted.  This file is also
      used to open the set of indexes for this database instead of
      selecting each index file to be opened for this database.
  13) Automatically repair "Not a table/DBF" errors encountered in
      corrupted databases which are caused by invalid record counts
      in the database headers.  These are the most prevalent errors
      encountered in databases, and usually occur when the database
      application crashes or terminates without properly closing the
      database, leaving the header in an indeterminate state.
  14) Allow file associations in Windows between .DBF files and
      DBPACK to automatically open up and show database files using
      DBPACK when you double click on their File Manager entries.

Note that DBPACK is a powerful and potentially dangerous utility that must
be used with care and intimate knowledge of the databases and indexes, and
what effects any changes that you make to those databases will have on any
other related databases.  You should be especially careful when deleting
or undeleting records, since those changes may break or recreate links
with records in other databases, which are re-formed when your applica-
tions use those databases and define parent/child relationships between
them.  It is therefore highly recommended that you MAKE A BACKUP COPY OF
YOUR DATABASES AND THEIR INDEX FILES AND MEMO FILES (.FPT's) BEFORE YOU
RUN DBPACK and check out your changes using your apps before deleting
those backups.

As a shareware program, you can try out DBPACK for free.  If you decide
to keep using it, please send your $10.99 registration fee to Maristream,
Inc., along with your completed registration form (which is printed from
the Registration screen).  Also, please read the licensing agreement (in
license.txt) before you start using DBPACK.  If you find any errors in
DBPACK, please let us know as soon as possible by sending a description
of the problem to the address above, so that we can fix the problem and
release an updated version of DBPACK (and send you the updated version).
The installation instructions for DBPACK are given at the bottom of this
file.


RUNNING DBPACK

DATABASE Button:

When you start DBPACK, by double clicking on it's Maristream icon, you
will first need to either type in the full pathname of the database or
select the database from the file list that is brought up by clicking on
the DATABASE button (or pressing Alt-D, which is the underlined hot key
for that button).  If the database can't be opened because of a corrupted
header (resulting in "Not a table/DBF" messages from your app), DBPACK
will fix the header and open the repaired database, if possible.  NOTE:
You must reindex the database if it is repaired by DBPACK to reestablish
the correct index pointers.  After opening the database, DBPACK will show
how many records are in the database before and, potentially, after pack-
ing, along with the percentage of space saved if the database is packed.
If the database is already packed, this will be noted on the main DBPACK
screen and the Pack button will stay disabled.

If you have previously created an index description file (.DBI) for this
database, DBPACK will ask you if you want to use the index files previously
saved in the .DBI file.  If you do, answer Yes to the prompt, and DBPACK
will open up all of those index files, possibly recreating index files
which are corrupted or missing.  Instead of reindexing the database, you
can also have DBPACK recreate your indexes using that .DBI file information
by first deleting the .IDX or .CDX file(s) before opening the database to
pack.  (If you get a message like "Variable 'NAME' not found.", that means
that one of the independent .CDX's has index tags that are not associated
with this database.  Write these variable names down and go through the
index detail description screen using the SHOW button and close those
index files which have those tag names, as described below.)

If there was not a .DBI file, or, if you answered No to the .DBI prompt,
DBPACK will search through the directory containing the database to create
a list of index files which may be associated with this database.  It will
try to exclude as many possibilities as it can, including .IDX files with
tags that don't match the database fields, and .CDX files which have the
same leaf names as other databases in the directory, but, some unrelated
index files may still be listed as possible indexes for this database.
The database's structural compound index file (database.CDX) will be auto-
matically opened with the database, and will not be included in this list.

DBPACK will show you the list of potential index files and ask if you want
to open all of them up.  If you do, answer Yes to the prompt, and DBPACK
will open up all of those index files.  (If any of those index files are
corrupted, DBPACK won't be able to recreate them, since it is not looking
in the .DBI file at this time, if one even exists.)  Otherwise, those index
files will be listed at the bottom of the main DBPACK screen, and you will
be able to pick the index files from a file list that will be displayed
containing the index files in the database's directory.  The names of the
index files that you choose will be changed to upper case in the list of
files at the bottom of the screen.  Click on the CANCEL button after you
have finished picking all the associated index files.

After DBPACK has opened up the index files, which will be ordered by the
single index files, followed by the structural compound index file,
followed by the independent compound index files, you will then be able
to work with the database and index files.  However, if you happened to
open up any independent compound index files that aren't associated with
the database, indicated by Variable Not Found warning messages (described
above), you will first need to click on the SHOW index button, go through
the list of indexes, and close the index files containing those variables
that you wrote down from those warning messages.  Clicking on the CLOSE
INDEX button may eliminate more than one of those variables if the index
file contains more than one index tag.  DO NOT REINDEX a database for
which you have unrelated index files opened, or you will mess up that
information for the databases that are supposed to use those index files!


USING DBPACK MAINTENANCE FUNCTIONS

PACK Function:

If there are deleted records in the database which haven't been removed,
the PACK button will be enabled.  Clicking on the Pack button will pack
the database, removing all of the deleted records from the database file,
pack the database's memo file (.FPT), and reindex all of the index tags
and files currently in use.  Afterwards, the Pack button will be disabled,
and the statistics about the results after packing will be shown so you
can see the space savings from the pack (the percent of records removed
from the file).  If you subsequently bring up the database browse screen
and, possibly, delete records from the database, the Pack button will be
re-enabled.

REINDEX Function:

If you only want to reindex the database, click on the REINDEX button to
reindex all of the index tags and files currently in use.  Afterwards, the
Reindex button will be disabled.  If you subsequently bring up the data-
base browse screen and, possibly, delete records from the database, the
Reindex button will be re-enabled.  As mentioned above, make sure that
only index files related to the current database are opened before you
do a reindex.

ADD INDEX Function:

The ADD INDEX button allows you to add another index file which you may
have left out of the current list of index files that were opened.  It
brings up the list of index files in the database's directory for you to
pick from.  Do not open up the same index file more than once.

BROWSE Function:

To see the records in the database, click on the BROWSE button, bringing
up a full screen browse window of the database's records which is sorted
by the current controlling index tag.  Besides viewing the data, you can
also edit any field in any record in the database by clicking on it or by
arrowing to that field and typing in the changes, if the ALLOW EDITS box
is checked in the main screen.  Be careful that you do not change fields
that are used to relate databases to each other, unless you really do want
to change those relationships.

BROWSE Controls:

The VERTICAL switch will cause the Browse window to display the records
with one field per row, so you will see multiple lines per record.  If
this switch is not set, a regular Browse window will be displayed with
one record per row, showing all the fields of each record on one line.

Setting the ALLOW EDITS switch lets you edit fields in the records, as
mentioned above.  If the ALLOW DELETES box is checked in the main screen,
you can "delete" any record by clicking on the narrow box to the left of
the record, which is indicated by that box turning black.  Similarly,
you can "undelete" any record by clicking on that box to turn it white.
Pressing Ctrl-D after clicking on a record also deletes/undeletes that
record.  Pressing Ctrl-Z marks all records in the database for deletion.
Pressing Ctrl-R recalls all deleted records by unmarking their deleted
flags.  Again, be aware of any relationships with other databases that
may be broken or re-formed by the deletion or undeletion of records.

HIDE DELETES will hide those records on the Browse window which have
been deleted.  If you delete a record, it won't "disappear" from the
screen until after you scroll past it the first time.

You can print the database's records (excluding the deleted records) by
pressing the F9 function key from the Browse window.  The memo fields
won't be printed unless the PRINT MEMOS box is checked in the main
screen.  Press the ESCape key to close the database browse window.

SEARCH/SELECT Records:

From the Browse window, you can press F5 to bring up a Search screen.
This allows you to build up a search criteria string by either using
popup menus of field names and comparisons, or by typing in your own
comparison string.  To build each criteria to match, click on the upper-
left-most popup menu and select the field from it.  Then, click on the
middle popup menu and select the comparison from it.  Some of the entries
in the comparison menu will be disabled, depending on the type of the
field that you selected (character, numeric, logical, date, or memo).
If a value must be entered for this comparison, type it in next, without
including the quotes if you are doing a string comparison.  For dates,
enter them in mm/dd/yy format.  If you need to enter two or more values
for this comparison (for between or inlist), separate them with commas.

You can click on the NOT button to exclude matching records for this
criteria.  You can also enclose multiple criteria within a pair of
parentheses, to cause them to be evaluated together, by clicking on the
left parenthesis on the first criteria of the set, and clicking on the
right parenthesis on the last criteria of the set.  Only one level of
parentheses can be added through the menus.  To add additional levels,
you will need to edit the resulting criteria string.

After the field, comparison, and value have been selected and entered,
click on the AND button or the OR button to continue with the next
criteria (separated by AND or OR), or, click on the DONE button to
complete the criteria and build the resulting criteria string.  If you
want to make a change in the criteria string, you can edit the criteria
string by typing in the changes.  You can also click on the individual
comparison line and press the AND or OR button to change that connector,
or, press the Delete key to remove it from the comparison list and copy
it back into the menu area to be edited and re-entered into the list,
or cleared out of the menu area (using CLEAR THIS) if you don't want it.
(If you happen to press the DONE button with entries in the menu area,
that comparison will be entered into the criteria list and joined to the
previous criteria with an AND.)

You can change the order of the criteria in the list by clicking on the
comparison to move and press the Page Up or Page Down button to move it
up or down in the list.  Only the comparisons are moved - the AND's and
OR's remain where they are.  Instead of always appending criteria to
the end of the list, you can click on the line in the list where you
want the next criteria to be placed to insert a criteria into the list.

When the criteria string has been completed, click on the search button
that you want to perform the search, either from the top, or to the next
occurrence, or to the previous occurrence, or from the bottom.  If a
matching record is found, it will be highlighted momentarily, and the
Search screen will be brought back up for the next search.  Click on the
EXIT button to get out of the search screen if this is the record that
you want.  You can also show just the matching records by clicking on
the SHOW ONLY button, or all records by clicking on the SHOW ALL button.
The CLEAR ALL button will clear the criteria from both the list and the
string, but will not clear the current subset filter (use SHOW ALL).

BROWSE STRUCTURE Function:

The BROWSE STRUCTURE button shows you the structure of the database,
including field names, types, lengths, and decimal places, where applic-
able.  You can print the database's structure by pressing the F9 function
key.  If you only want to see a subset of fields in the Browse database
screen, or in a printout, or exported to another file, you can "delete"
the fields that you don't want to see using this screen.  Similar to the
Browse database screen, you can use Ctrl-D, Ctrl-Z, or Ctrl-R to delete,
delete all, or recall all of the fields.   Press the ESCape key to close
the database structure browse window.

HELP Function:

The HELP button brings up this readme.txt file as a help screen.  You can
print the displayed text file by pressing the F9 function key.  Press the
ESCape key to close the help file browse window.

SAVE AS Function:

The SAVE AS button saves the currently selected records and/or fields to
any of 15 data formats.  Before clicking on the Save As button, select
the data format to save by bringing up the popup menu below that button
and clicking on the format that you want.  For the Other Delimiter format,
you will also be asked to press the key to use as the delimiter.  If you
are currently viewing a subset of records (using the Show Only button of
the Search/Select screen), only those records will be saved.  If this
isn't what you want, go back to the Browse database screen, bring up the
Search screen, and click on the Show All button so that all of the records
will be saved.  Also, if you have excluded some of the fields (using the
Browse Structure screen), those data fields will be excluded from the
output.  If this isn't what you want, go back to the Browse Structure
screen and press Ctrl-R to recall all of the fields so that all of them
will be saved.

When the data format and records/fields have been selected to save, click
on the Save As button to bring up the file list screen, which will display
only the files with the appropriate extension, and select one of those
files to overwrite, or, type in a new file name to create a new file.  Be
sure to use the appropriate extension on the file name; otherwise, the
software that you use that exported file with may not recognize the file
as one of its own file types.  If you save it as a .DBF file, any current
structural compound indexes will also be created for that file, except
for those indexes containing fields that have been excluded.

Exiting The Database:

When you have finished working with the current database, you can click
on the DATABASE button to specify another database, or click on the EXIT
button to exit from DBPACK.  Before closing the database and index files,
DBPACK will ask if you want to save the index file list for the database
containing the descriptions of the indexes used during this session for
this database.  If you do, answer Yes to the prompt, and DBPACK will save
the index descriptions to the .DBI file (database.DBI) for you to use the
next time you select this database in DBPACK.  Since the .DBI file is
associated with the similarly named .DBF database file, you can have
separate .DBI files for each of your databases.

You can move the database and its index files and .DBI file to another
directory, and DBPACK will automatically update the .DBI file to reflect
that new directory the next time it is used.  However, if you rename the
.DBF file, you will need to use DBPACK to open up the .DBI file and edit
the file names in it to reflect the new name.  You will probably get the
message "Can't open index file descriptions" when you try to open the
.DBI file, and don't open any index files with it.  If you can, it would
be easier to just recreate the .DBI file by opening up the database and,
then, opening up the index files explicitly and clicking on the EXIT
button to have DBPACK save the index descriptions.

Index BROWSE Function:

Like the database, you can also browse through the active index tags by
clicking on the BROWSE button in the index list section in the lower
portion of the main screen.  If a controlling index tag is active, the
browse will be highlighting that active tag's record.  You can select
one of the other indexes to be the current controlling index tag used to
display the sorted database records by clicking on its record and then
pressing the Enter key to select it.  Subsequent browses of the database
will then be ordered by that index tag.  You can clear the current
controlling index tag, leaving the database unsorted, by pressing the
F4 function key.  You can print the active index tags by pressing the
F9 function key.  Press the ESCape key to close the index browse window.

Index SHOW Function:

The SHOW button in the index list section brings up an index tag descrip-
tion screen to show the individual index tags and their modifiers.  Use
the four navigation buttons on the bottom of the screen to scroll to the
first, previous, next, or last index tag record.  For each index tag, this
screen shows the index file name, the index type (Single for .IDX, Struct-
ural for .CDX, Compound for independent .CDX), the tag name, the sequential
tag order number, the key expression (giving the order of the database),
whether the index is in descending order (default is ascending), whether
the index is unique (allowing only one record per index value), the for
expression (to select subsets of the database), and the collating sequence
(which is usually machine).  Clicking on the IS CONTROLLING INDEX box will
select this index to be the current controlling index tag to show the data-
base sorted by that tag. The CLOSE INDEX button will close this index file,
removing all of its index tags from the current session, unless it is the
structural .CDX index file, which can't be closed.  Click on the EXIT
button to close this screen.

REGISTER Function:

The REGISTER button on the main screen brings up the registration screen
for you to fill in to print out the registration form that can be sent in
with your payment.  This screen also comes up when you exit from DBPACK
until you enter your registration number that you will receive from us when
you register DBPACK.  This number is keyed to your name and company name,
and all three of those fields must remain unchanged for the registration to
remain in force; otherwise, it will revert to unregistered.  Besides the
standard registration information, you can also enter comments and sugges-
tions for DBPACK, which will be printed on the registration form that you
send in.  We're always looking for ways to improve our products for you.


INSTALLING DBPACK

If you received DBPACK on two floppy disks:

   1) Insert floppy disk labeled Disk 1 into your A drive,
   2) Bring up the Windows Program Manager,
   3) Click on File in the Program Manager's menu,
   4) Click on Run in the File menu,
   5) Type A:\SETUP in the Command Line and follow the instructions
      in the Setup screens.

This will install DBPACK into the C:\DBPACK directory on your PC.  If
you need to install it from floppy drive B, change steps 1 and 5 above
to drive B instead of drive A.  If you need to install it to a different
directory, change the directory name in the Setup screen during step 5
above to include the full directory name, including the disk drive letter,
such as D:\DBPACK.

If you received DBPACK as a .ZIP file:

   From the DOS command line:
   1) Make a directory for it using the MD command, such as MD C:\DBPACK,
   2) Type CD C:\DBPACK (or whatever directory name you created), 
   3) Copy DBPACK.ZIP into the C:\DBPACK directory, if it is not already
      there, and
   4) Type PKUNZIP DBPACK.ZIP (PKUNZIP is not included with DBPACK), or
      use some other unzip package, such as WINZIP from Nico Mak.
      
   To create an icon in Windows for DBPACK:
   1) Double click on the program group's icon in the Program Manager
      screen to put the icon into, such as Applications,
   2) Click on File in the Program Manager's menu,
   3) Click on New in the File menu,
   4) Click on Program Item, and then the OK button, in the New Program
      Object screen,
   5) Type in "Database Packer" in the Description field in the Program
      Item Properties screen (without the quotes),
   6) Type in "C:\DBPACK\DBPACK.EXE" in the Command Line field (or,
      wherever you put DBPACK),
   7) Type in "C:\DBPACK" in the Working Directory field,
   8) Click on the Change Icon button and double click on the Maristream
      icon in the Change Icon screen,
   9) Click on the OK button in the Program Item Properties screen to
      create this new icon.
