home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
dbclinic.zip
/
DBCLINIC.DOC
< prev
Wrap
Text File
|
1987-02-14
|
6KB
|
120 lines
DBCLINIC.BAS
A UTILITY PROGRAM FOR dBASEII (tm) FILE MAINTENANCE
DESCRIPTION
The "Data Base Clinic" is a handy utility to have around when
working with data base files with extension type .DBF or .TXT but
of unknown or questionable size or integrity. It can display
Structure header information from .DBF files or count the actual
number of records they contain and allow you to change the record
count and/or "last update" date. It can also find the record
lengths and number of records in .TXT files. It is written in
Microsoft's BASIC-80 (tm) (the Disk MBASIC (tm) for CP/M)(tm),
Version 5.x, and is menu driven and fully prompting. The program
contains five Wards, or modes of operation:
WARD-A: This portion of the program displays the Record Length
of a given .DBF or .TXT file. With .DBF files, it gets
this information from the file Structure header. With
.TXT files, it actually samples the file and checks the
length of the first record (up to 1000 characters--the
dBASEII (tm) limit for record length).
WARD-B: Ward-B displays the actual Structure header information
from any .DBF file in the .LIST STRUCture format of
dBASEII (tm). This Ward is only available to .DBF files,
since .TXT files do not have file Structure headers.
Note that, although this is a quick way of finding out
how large a file is, in terms of numbers of records,
there are times when the number can become corrupted, so
that it is actually smaller than it should be--as when a
power glitch or computer hangup requires a RESET or re-
boot, leaving the header information un-updated. Any time
a file is not closed by QUITing, this can occur. In such
a case, a visit to Wards C and D is in order.
WARD-C: This is the heart of the program! In this Ward, you
can actually get an exact count of the number of
records a data base file contains. It uses a binary
search pattern to find the end of the file very
quickly, and then backs off 2K bytes and counts to the
end of the file. A final count is usually displayed
within 10 seconds or less. The program limits out at
32,767 x 128 bytes (that's 4-megabytes!!--which should
cause no problems to the average user). This Ward is
open to both .DBF and .TXT file types.
WARD-D: This Ward is for displaying and changing the Record
Count in a file's Structure header, if it happens to be
different from the count obtained in Ward-C; a handy
tool when the header becomes corrupted, since Sorting and
Indexing won't work correctly until the number of re-
cords in the header is correct. If you make a mistake
in your entry, use the BACKSPACE key to rub out to the
last good digit and reenter. THE MAXIMUM NUMBER THAT
CAN BE ENTERED IS 32,767, because of MBASIC's integer
limits. But then, who has database files over 32,767
records long? This Ward is only for .DBF files.
WARD-E: This Ward allows the Last Update date to be displayed
from the file's header and changed. Suppose you en-
tered dBASEII (tm) with a 00/00/00 (no entry) date and
later thought better about it. You can easily correct
the header date, using Ward E. Your entry will auto-
matically be accepted, updated, and verified after the
sixth digit is typed in. You won't have to type in
"/" month-day-year separators, nor will they even be
accepted. Prior to keying in the last digit, if you
have made a mistake, hit the BACKSPACE key once to
clear your entire entry so you can begin again.
USING THE PROGRAM
As mentioned at the start, the program is menu driven and fully
prompting. You just can't make a mistake (well, almost). It
will not accept a file name without a .DBF or .TXT extension or
one with a disk drive designation higher than D: (highest drive
is easily changed, however). If you find yourself in a situation
where you don't know what file name to enter, just enter DIR to
get a Directory of your disk. Also, if you are in Wards D or E
and decide that you don't want to change the file header after
all, simply reenter the same record count or date that is being
displayed.
One more thing! If you insert a new disk at any time, you should
immediately "Reset" the program. This is done by entering a "null"
filename at the "ENTER FILENAME (DIR=DIRECTORY):" prompt; that is,
by simply pressing the carriage RETURN key before any other charac-
ter. The only response you'll notice is some disk drive activity.
Failure to do this will get you a "Bdos Error: Drive $R/O" error
from CP/M (tm) in Ward D or E, when the program attempts to write
the update information back to the file header.
In its present form, this program WILL NOT compile under BASCOM
(tm), due mainly to the use of unusually long variable names.
It has some other serious problems as well. Ask me about them!!
Except for a speed-up in program loading, there would be no real
advantage to compiling, since all significant runtime delays occur
because of disk accessing, and there is no way to speed that up.
Please enjoy this utility!
Dick Bollinger
(P.S. This program has been tested on both floppy and hard
disk drives! But if you do find a bug in the program,
I'd appreciate it if you would please leave me a mes-
sage on Stu's RBBS; phone [714] 599-2109; giving full
details: Ward you were in, file record length, number
of records, ERR and ERL numbers, what happened, etc.
I'll get back to you; that's a promise.)
(tm) "dBASEII" is a trademark of Ashton-Tate
"BASIC-80","MBASIC", and "BASCOM" are trademarks of Microsoft
"CP/M" is a trademark of Digital Research