home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
dbase
/
_base16.zip
/
RUNBASE.DOC
< prev
next >
Wrap
Text File
|
1994-02-13
|
13KB
|
337 lines
The RunBase Utilities
Version 1.6
(C) Copyright 1991, 1992 All rights reserved.
RunBase (!BASE) is Copyrighted by:
Cynthia L. Allingham
16411 McFadden Ave. #320
Tustin, Ca 92680
(714) 543-4241
What are the RunBase Utilities?
================================================================
RunBase consists of 7 handy command line utilities for all
dBase, Clipper, FoxPro and CodeBase programmers. All of the
RunBase utilities are small, fast, support IO redirection, and
full path expansion.
They are easy to use, since they accept the same parameters that
their DOS or dBase equivalents do. To get help on any utility,
just type in the name of the utility without any parameters.
!APPEND <FILENAME.DBF> <FILENAME.TXT> [-Q]
The worlds fastest Append SDF. This utility appends records
10x faster than the APPEND SDF command in FoxPro or Clipper.
!COMP <A:> [<C:>]
A structure comparison utility. It compares the file
structure of any two DBF files, and flags the differences.
!COPY <C:> [<A:>] [-P -Q -Sn]
The world fastest Database Copy. In the process of copying
it will generate a "packed" copy of the DBT file, and
optionally remove deleted records. USE THIS UTILITY INSTEAD
OF PACK.
!DIR [<*.*>]
Directory of DBF files. This utility displays the number of
records in each database.
!INDEX [<*.*>]
Directory of INDEX files. This utility displays the index
expression of NDX, NTX, and IDX files.
!STRUCT [<*.*>] [-A -F -N -C]
Displays the structure of DBF files. The output can be
created in several different formats that are useful for
Clipper and CodeBase users.
!ZAP [<*.*>] [-Sn -Y]
DBF file zapping utility. It allows files to be quickly
zapped or truncated.
================================================================
!APPEND
Append a length delimited text file.
================================================================
!APPEND was inspired by the slowness of the APPEND SDF command
in Clipper. So I wrote a stand alone replacement utility called
!APPEND. It is worlds fastest implementation of APPEND SDF, and
it has displays a pop up status bar.
I used it to reduce the time it takes to import a large file
into a dbase file format from HOURS to MINUTES.
EXAMPLE #1: APPENDING THE THIS TEXT FILE TO TEST.DBF
One common use of the APPEND command, is to import the contents
of a text file into a database, so you can use it with the dbase
browse command. To do this with the contents of RUNBASE.DOC,
create a dbf file (called TEST) with one 80 character field, and
type:
!APPEND TEST RUNBASE.DOC
This is also an easy way to fill up an empty DBF file with a
large volume of completely random dummy data, for testing
purposes.
This is also an easy way to fill up an empty DBF file with a
large volume of completely random dummy data, for testing
purposes.
================================================================
!COMP
Compare two database structures
================================================================
!COMP was the first utility I wrote. I decided I needed a
utility to compare database structures several years ago when I
traced a bug in a program I inherited to the fact that the
customer field was defined as being a different length in three
different databases.
EXAMPLE #1: COMPARING SIMILAR FILE STRUCTURES
In this example, the customer and prospect file both contain the
same type of data. To compare them, specify the name of both
files:
!COMP CUSTOMER PROSPECT
OUTPUT:
Comparing: CUSTOMER.DBF PROSPECT.DBF
# of Records: 6 90
Last Updated: 6/11/92 9/05/92
1 NAME C 29 NAME C 29
2 POSITION C 25 POSITION C 29 <== Field changed
3 PHONE1 C 13 PHONE1 C 13
4 PHONE2 C 13 PHONE2 C 13
5 STREET C 29 STREET C 29
6 CITY C 29 CITY C 29
7 STATE C 2 STATE C 2
8 ZIP C 5 ZIP C 5
9 BIRTHDAY D 8 ................... <== Field deleted
** Total ** 153 149
EXAMPLE 2 : DISPLAY DIFFERENCE BETWEEN DIFFERENT VERSIONS
This utility can also be used in project management. By
comparing the current databases with an older version, I can
quickly determine which fields have been added or changed.
Specify the path name of both the directory that contains your
old data file, and your new data files:
!COMP C: A:
Or if there is more than one screen of data, use the DOS MORE
command:
!COMP \oldver\*.* *.* | MORE
The "| MORE" clause, uses the external DOS command MORE, to
cause the display to pause, after every screen full of data.
Alternatively, you could redirect the output to the printer:
!COMP \oldver\*.* > PRN
Note that the second path name is not specified so it defaults
to using the current directory.
Use of the clause "| MORE" and "> PRN" is supported by all of
the RunBase Utilities. Please see your DOS manual for more
information about piping and redirection.
================================================================
!COPY
Copy DBF files
================================================================
The DOS COPY command is fast and convenient, but it doesn't
"pack" the DBT files or remove deleted records, and the
dbase/clipper COPY TO command does, but it is very SLOW.
So I wrote a stand alone utility called !COPY combine the speed
of the DOS COPY command with the utility of the dbase copy
command.
The !COPY utility also copies the DBT file, supplies an empty
DBT file if the DBT file is missing, and gives a warning message
when it encounters invalid memo field records records.
SYNTAX: !COPY <*.*> [<*.*>] [-P -Q -Sn]
-P = Pack mode (remove deleted records)
-Q = Quiet mode (do not display the status bar)
-Sn= Save mode (Copy only the first <n> records)
EXAMPLE #1: PACKING A FILE
To pack your data, call the !COPY utility with the -P (Pack)
parameter. The following batch file creates a packed copy of
the sample database, and if the !COPY command does not return an
errorlevel it deletes the sample and renames the file.
!COPY SAMPLE TEMP -P >> ERRORLOG
IF ERRORLEVEL 1 GOTO END
DEL SAMPLE.DB?
REN TEMP.DB? SAMPLE.*
:END
EXAMPLE #2: COPYING A DATA SUBSET
Clients often have more data than you wish to use for testing
purposes. To copy only the first 100 records of a clients data
to a floppy to use as sample data, type:
!COPY *.* A: -S100
================================================================
!DIR
Directory Listing of DBF files
================================================================
!DIR is a replacement for the DIR command to use with DBF files.
It displays information about DBF files, including the number of
records.
EXAMPLE #1: DISPLAY A LIST OF DATABASE FILES A PAGE AT A TIME
The output can be piped into the more command, using the pipe
symbol "|", will cause the output to pause after displaying a
screen full of information:
!DIR | MORE
OUTPUT:
Database Files # Records Last Update Size
COMP.DBF 2,638 08/18/92 1,824,333
CPU.DBF 18,990 08/18/92 1,994,497
KEYS.DBF 10 06/15/92 289
MENU.DBF 8 06/19/92 307
OS.DBF 10 05/14/92 1,497
3,820,923 bytes in 5 files.
================================================================
!INDEX
Directory Listing of index files
================================================================
Another problem I was having is with remembering which index was
which. Let's face it, it is difficult to create fully
descriptive file names with a maximum of eight characters. So I
decided to write another utility, !INDEX.
!INDEX operates the way the DIR command does, but it provides
more information about index files, including the original
expression that was used to build the index.
EXAMPLE #1: DISPLAYING THE INDEXES ON THE CUSTOMER FILE
Since all indexes on a given file usually start with the same
letter, wild cards can be used to select only the indexes on
the customer file:
!index cust*
OUTPUT:
Index Name Size Index Expression
CUST_1.NTX 2,048 company+state+city
CUST_2.NTX 4,096 cust_no
4,096 bytes in 2 files.
================================================================
!STRUCT
DBF file structure listing utility
================================================================
!STRUCT displays the structure of a DBF from the DOS prompt.
EXAMPLE #1: PRINTING A HARD COPY OF ALL DATABASE STRUCTURES
Use the redirection symbol ">" to pipe the output to the
printer:
!STRUCT *.* > PRN
!STRUCT has a number of command line switches that will produce
output suitable for importing into PRG's and using to create
REPLACE statements, header files, or an array for use by
DBCREATE().
OPTIONS FOR USE WITH CLIPPER:
-A Create database structure arrays for use with DBCREATE()
-F Create field name declarations
-N Create field number define statements for use in header files
EXAMPLE #2: GENERATING CODE FOR USE WITH DBCREATE()
Use the -A parameter to specify database structure output,
and redirect the output to a source code file:
!STRUCT CONFIG.DBF -A > CREATE.PRG
For information on how to use this utility to enhance your
clipper programs, read the file CLIPPER.DOC.
OPTIONS FOR USE WITH CODEBASE:
-C Create database structure arrays for use with d4create()
EXAMPLE #3: GENERATING CODE FOR USE WITH d4create()
Use the -C parameter to specify database structure output,
and redirect the output to a source code file:
!STRUCT CONFIG.DBF -C > CREATE.C
================================================================
!ZAP
Zap or truncate DBF files
================================================================
!ZAP does the opposite of !APPEND. !APPEND adds records, !ZAP
deletes them.
SYNTAX: !ZAP [<*.*>] [-Sn -Y]
-Sn Save first <n> records and zap the rest
-Y Yes, automatically bypass the safety prompt and zap away
EXAMPLE #1: ZAP ALL FILES
!ZAP
The default to zap all data, and ask if your sure for each file.
EXAMPLE #2: REMOVE EXCESSIVE TEST DATA
To retain only the first 50 records in the customer file:
!ZAP CUSTOMER -S50
EXAMPLE #3: ZAP WITHOUT PROMPTING
To zap all files beginning with the letters "TEMP" without
prompting:
!ZAP TEMP*.* -Y
Cynthia Allingham Software Services
================================================================
I am a professional programmer located in Tustin California,
specializing in developing business applications in Clipper and
C++.
I wrote the RunBase utilities because there aren't very many
good utilities to available for use with dBase files. I made
the RunBase utilities free and kept its size small, so that you
can easily and legally install a copy of these handy utilities
on your clients hard disk.
While the RunBase utilities are free, I do appreciate hearing
about them from the users. If you have comments or suggestions
please contact me.