|Everything HP200LX: Knowledge, Products, Service|
Through the Looking Glass:
Fixing and Speeding Up Database Files : What to do when you get Record Not Found or Cannot Open File error messages with any of the palmtops built-in database applications (ApptBook, Database, PhoneBook, NoteTaker and WorldTime).
One of the greatest strengths of the palmtops database engine is that each application can hold an excessively large number of entries. Some users have reported that they keep thousands of phone numbers in their palmtop. Others have created custom databases with 1,500 records or more. The database file sizes are often in the neighborhood of 1 Megabyte.
How can the palmtop work with database files that exceed the working memory of the computer? It does so by using a trick. The database engine creates an index of all the records in a database and attaches this index to the information file. Its like writing a reference manual and attaching an index to it. When you start a database application, the engine extracts the index from the database file and puts the index alone in working memory. This index serves as the raw material for the list view that appears on the screen. When you highlight one of the records in the list and press (Enter), the engine reaches out to the RAM disk and copies that record into working memory so you can view it or modify it.
When you add, modify, or delete a record, several things happen in the background: the record is stored on disk (or deleted from the disk). Then the index is updated and the database file is resized to make it as small as possible. Some people compare this resizing to defragmenting a hard-disk or packing a database file. Packing is a term that is familiar to dBASE users. On the palmtop, this resizing or packing happens on-the-fly as you work with a database. It ensures that your information is up-to-the-minute and safe. The drawback is that, if you have a large database, resizing and reindexing can take a long time.
When you close a database application, the index is reattached to the information file and the program shuts down gracefully. Everything has been designed to work flawlessly and reliably, but, on rare occasions, things can go wrong. For instance, a portion of your PC card might go bad for some inexplicable reason, thereby messing up several records in a database file. Your palmtop might decide to lock up while its trying to resize or close a file. You wont know that something went wrong until the next time you try to load the database file. Then you'll get an error message telling you that a record cant be found, or, worse yet, the database cant be loaded.
Don't panic. This has happened to palmtop users before. Fortunately, it seems to happen most often to programmers. Its indeed fortunate for us, since they've taken the time to create some very useful techniques and tools that will help us fix broken database files.
The most secure cure: use an up-to-date backup
The best way to cure a broken database is to throw it away. Delete it from the disk and start over with a recent backup of the database file.
However, before you delete the damaged file, do the following. Terminate all applications and exit System Manager (use More Menu Application Terminate All OK). Switch to the drive that holds your database files and type in the DOS command CHKDSK and press Enter. If you get a message that tells you that your disk has errors, use the CHKDSK /F command to fix the problem. Better yet, if you have a program such as Norton's Disk Doctor, try using that to repair the files. When you're confident that your RAM disk is in working order, reload System Manager and try opening the database again.
If you still get an error message, then its time to fetch the backup file. Begin by renaming the backup file to something like ZZZ.xDB (where the x would be an A, G, N, P, or W, depending on the type of database file: ApptBook .ADB file; Database .GDB file; NoteTaker .NDB file; PhoneBook .PDB file; or WorldTime .WDB file). Load this ZZZ file into the application program.
Why rename the file and load it? Well, if you backup your palmtop frequently, you may have inadvertently backed-up an already broken file. If that's the case, it doesn't make sense to overwrite one broken file with another one. If the back-up file is good, close the application and use Filer to delete the broken file and rename the ZZZ.xDB file. You'll have to re-enter any records that were added or changed since the last backup. How current your backup file is will determine the amount of work involved.
Less sure (but useful) file recovery techniques
If your backup files are unusable, there are still some things you can do to recover as much information as possible.
Merge the file
If you're able to start an application but the database file causes a Record Not Found error message to appear on the screen, press the (Enter) key and choose the (Menu) File New...command. This will create a new database with the same layout as the errant one. Then use the (Menu) File Merge command and try to bring the broken file into the new one. This simple technique may not work every time, but its a good thing to try.
Sort and Copy
The Record Not Found message usually means that there's a glitch in the index of the database. Sometimes you can cure this by using the (Menu) View Sort command that's available in every database application except the Appointment Book. If the database file contains subsets, activate each subset and perform the (Menu) View Sort command. When you've finished sorting all the subsets, use the (Menu) File Copy... command to save the file under a new name. Quit and restart the application, and try re-loading the new database file. If you can load it without any error messages, you've lucked out!
If your Appointment Book file is corrupt, you wont be able to use the sort-and-save remedy, since the Appointment Book doesn't have a sort operation. Instead, here's a remedy suggested by: Bill Ferreira (CompuServe: 76520,3702). Bill writes: Create a new Appointment Book (say XX.ADB) and merge your bad Appointment Book file into the empty one. Find long repeating entries and delete them one at a time, saving and reopening the new XX version of your appointment book.
Hopefully this suggestion will put the Appointment Book file back in working order. If it does not, and your Appointment Book file is less than 30K bytes, you might be able to use the ABDDUMP n utility program. ABDDUMP will take your broken file and attempt to create a humanly readable text file. If it can do this, then the companion program ABDLOAD n will let you rebuild your Appointment Book file. Both ABDDUMP and ABDLOAD can be found in the archive file called ABDIO either in the HPHAND forum on CompuServe, or on The HP Palmtop Papers 97 CD InfoBase.
Cannot Open File
The Cannot Open File error message will appear if you've inadvertently moved your database file to another drive or directory or swapped one PC card for another one. In this case the message means that the program Cannot Find the File. Use the File Open command to get to the dialog box and use the drive and directory pick-lists to locate and open the file. However, if you still get the error message Cannot Open File then you've encountered a worst case scenario. Your file is so corrupted that the database application doesn't recognize it. Again: don't panic. There are still a couple of remedies that will let you recover some or all of the information in your file.
A touch of garlic
GARLIC is a utility program that tries to reconstruct any damaged database file on the palmtop. It works by scanning a corrupt database for anything it can recognize as a valid record. It then outputs this, along with reconstructed tables and links, to a new file for you to examine and edit. GARLIC is one of the last things you should try on a broken database file. If it works, consider yourself fortunate. The instructions that come with GARLIC give several options you can try with this utility program. GARLIC.ZIP is available in the HPHAND forum of CompuServe and The HP Palmtop Papers 97 CD InfoBase.
If all else fails...call on a PAL
If all the above fails, there's one last technique to try. Get a copy of PalEdit n , a fine text editor for the HP palmtop. PalEdit will let you open any file for editing. There are apparently no restrictions on the size of the file. Of course, once you bring the database file into PalEdit, you'll be faced with the daunting task of going through the document and deleting all the non-text characters. What you'll be left with is the raw data of the database file, minus any records that were totally corrupted. The next part of the operation involves creating a new database and using the Copy and Paste keys to copy the data from PalEdit to the database. By the time you finish this task you'll have vowed, once again, to make frequent backups. One learning experience, like this, is enough to last a lifetime.
An ounce of prevention
Fred Kaufman, one of the volunteer experts in the HPHAND forum on CompuServe offers the final bit of advice: My habit for many years has been to close each database application when I'm finished with it, rather than keeping it perpetually open. I don't think I have ever (knock on wood) had a corrupted data file. It is a bit slower to reopen, but it works for me. So I look something up, add a new item...whatever... and then I close [(MENU) Quit] the application.
Speeding up the Appointment Book
Palmtop users sometimes complain that one particular database application, the Appointment Book, is notoriously slow. It takes an inordinately long time to add an item to the Appointment calendar or ToDo list. Other users report that moving forward or backward in the calendar seems to take forever.
First, realize that slowness is a relative term. Nowadays, we've become accustomed to the speed of desktop or laptop machines that use 32-bit filing systems and have CPUs and disk drives that are 10 to 25 times faster than anything on the palmtop.
Having said that, here are some suggestions on how to speed up the Appointment Book application. If you keep your Appointment Book database file on a PC card that uses Stacker to compress the files, consider eliminating Stacker or else move the appointment file to the C: drive for faster processing. If you use a PC card to hold your database files and you notice that saving or closing a database takes a long time, it may be a sign that the PC card needs to be wear leveled. Heavily used sectors on PC cards eventually wear out. One symptom of this is that it takes more time to save data. The PC cards from SanDisk and HP come with a utility program called WEAR that will flag the worn out segments of the PC card as unusable and move your data to a part of the card that still has a lot of life in it. You only need to run the program once or twice a year. Several users have reported a noticeable increase in speed when they save or close a database file after wear-leveling their PC card . Delete or extract all out-of-date Appointments and ToDo items from the database. That is, use the (MENU) File Remove Before command, with the Save Removed Items option checked. You can save the removed items in a file with the name AUG97.ADB (or whatever) and then merge this with a larger archive file called APPT97.ADB. This will let you trim down the size of the current Appointment Book file while keeping a record of all your past accomplishments. If you notice that the File Merge operation introduces database errors in the merged file, you can always use the File Print command to send the database to an ASCII text file. Then you can use the DOS command COPY APPT97.TXT+AUG97.TXT BIGFILE.TXT and then COPY BIGFILE.TXT APPT97.TXT, and finally, delete AUG97.TXT. You can use MEMO or PalEdit to search through the text file for information that you might want to use during an annual appraisal review. Reserve the Appointment Book for upcoming appointments only. Some users have created elaborate database files to handle ToDo items . ToDo items that are Carried Forward ToDo's and repeating Appointments tend to slow down the Appointment Book. Try not to use them . If you prefer using Repeating Appointments, try not to modify or delete individual instances of a repeating appointment. This will let the Appointment Book start up more quickly and it will reduce the chances of introducing errors that may corrupt your database . If all these strategies fail to get you the speed you want, consider popping for a double speed crystal upgrade. This will make your palmtop anywhere from 150% to 200% faster. Be aware that HP considers this upgrade a violation of the standard warranty. If your palmtop requires service by HP, count on losing the expensive upgrade.
Speeding up ALL the databases\
Many users have tried using a program called FASTDB.TSR to speed up the performance of all their database applications. The TSR extension to the file name indicates that this program is a terminate and stay resident program peculiar to the HP palmtop. Once installed in the HP 100/200LX it modifies the operation of all the database applications.
Ordinarily, when you add, delete or modify an item in a database file and press the F10 (OK) key, the database engine modifies the file, updates the index to the file and then packs the file so that it is up-to-date and accurate. Packing can take a long time, depending on the size of the file. FASTDB.TSR postpones the packing process until you actually close the file. So if you have a lot of editing to do, you might save some time, but you'll have to wait a long time for the database file to close and get updated.
If, on the other hand, you have a large database file that contains data that is typically read-only, there is a down-side to using FASTDB.TSR. Each time you open and close the file, the size of the file will grow by several thousand bytes. If you're not aware of this, you might suddenly experience an insufficient disk space error.
Stan Dobrowski, one of the volunteer experts in the HPHAND Forum on CompuServe, discovered how to eliminate this side-effect. He suggests editing two records in the database ( two seems to be the magic number) and then closing the file. This forces the FASTDB.TSR program to update and pack the file. Other users suggest creating a System Macro that will add two dummy records to a database and immediately delete them just before closing the application. This has the same effect as Stan's suggestion.
Even with Stan's work-around, some users have reported that they have experienced corrupt database files once they started using FASTDB.TSR. So the best advice for using this program is to ensure that your database files are accurate and then back them up.
Copyright © 2010 Thaddeus Computing Inc