THE LONG AND SHORT OF WORDSTAR DOCUMENT FILES
by Bob Rosenfeld, SLKUG, August 1987

(How to work with large files and WordStar)

My major project, for the last few months, has been to inventory
my books, VCR tapes, audio cassettes, and magazines (the ones
that I save until they mold in the basement.)  Because of the
magnitude of the book inventory, I have split it into two main
categories:  COOK BOOKS (about 300 of them), and OTHER BOOKS
(about 2500 in more than 65 file transfer boxes.)

I suppose dBASE II would have been a more logical choice for
software, but although I have played around with it, I don't feel
as comfortable with dBASE as I do in good old WordStar.  The
short inventories that I have run before, amounted to ten pages
or less --- easily handled by WordStar --- but with the BOOK
inventory I have a list that covers 50 pages .... and I'm still
going.  Major problems:  searching for duplicate books; jumping
from one end of the file to the other; and saving the file.  It
takes several minutes for each search.  These problems were just
an inconvenience compared with the worst problem:  not having
enough room on the disk to allow the file to be searched or
saved.

I ran into trouble when the file on my Kaypro 10 reached 186K
bytes.  Okay, so the disks hold 390K bytes in theory, right? 
That is what it says when I check a freshly formatted floppy's
empty directory with D.COM.  You'd better not believe that you
can use the 390K bytes if you are working on a file.  The space
required is actually three times the size of your file.  First,
there is the space the file itself occupies.  Second, there is
the back-up file (marked with the extension BAK on the disk
directory.)  It takes up the same amount of space as the file did
before revision.  Third, when saving a file, the computer can
require just as much space as the file itself for temporary
storage while the process is being completed.  When you search a
file, the same thing happens.  The computer requires as much
space as the original file, temporarily, until the search is
completed.

I worked on the inventory file using my hard disk, and then
copied it to an empty floppy.  That meant there was no BAK file
taking up space on the floppy.  I had some additions to make to
the file that added about a page (about 9K.)  Well, 390K divided
in half is 195K, but I ran out of space searching a file of 186K. 
As a result I lost about two hours work.  Much like the confirmed
atheist, it couldn't be saved.  In desperation, I called Ken
Seger for help.  He came to the rescue with the suggestion of
using TXTSAVE.LBR or RESQ14.COM (from the SLKUG club disk #44.) 
I tried those programs, but alas, it was too late.  The demise of
the inventory of Book Box #65 had taken place.  I used NULU to
extract the utility files from TXTSAVE.LBR.  Then I used
WS3SAVE.COM (when you call it up, you get the simple instructions
on how to use it.)  It only brought back the middle of the file,
the inventory of Boxes #40 through #47.  Thank goodness, I had
backed up the file at the end of my last inventory effort.  The
list, including Box #64, was safe.  Now, I am reinventorying Box
#65.  I have learned several things through this exercise in
frustration:

1.  Periodically, save with 2KS.

2.  Don't put all your eggs in one basket -- split up your long  
  files.

3.  Use back-up disks.

With these three maxims in mind, you may save Ken Seger the
opportunity to help you out, and save your own temper and sanity
as well.

I am so remiss in saving my files that I have dedicated two "el
cheapo" alarm wrist watches for reminders.  These are the kind
that emit a little whimper, a single "beep", every hour, and give
a never-ending series of beeps when the alarm goes off (this
always occurs during the very quiet musical passages at a
symphony concert.)  The time settings on the watches are set half
an hour apart.  In this way, I get a beep every half hour.  When
I get beeped, I SAVE!!  Even in the middle of a sentence, I SAVE! 
Even while I am in deep thought with my eyes closed (Henry calls
this napping, I call it meditation), the beep sets off the
conditioned response to SAVE!  I hit 2KS, and after the save, it
is followed by 2QP that puts me right back where I was (but not
necessarily with my eyes closed.)  Now, this is the right thing
to do (it says so in the "Good Book", the Kaypro User's Manual.) 
But for long files, saving takes such a long time that it could
result in a resumption of somniferousness.  To avoid this we go
to the next rule:

Use short files!  With my 65 boxes of books, I had to resort to
subterfuge.  I create a separate file each time I start to
inventory another box.  The main file is called INVENTOR.BKS (for
INVENTORY of BOOKS.  I called the sub-files INVBOX65.BKS, for
INVENTORY of BOX #65 of BOOKS.  When I finish inventorying and
saving the file of Box #65, I go to the main file, INVENTOR.BKS,
and set the cursor at the end of the file.  Then I use 2KR.  When
I get the prompt asking what file I want to read, I enter
A:INVBOX 65.BKS.  Wordstar then picks up a copy of the sub-file,
INVBOX65.BKS, and writes a copy of it at the end of the main
file,INVENTOR.BKS.  I immediately use 2KD to save the main file,
and to exit the file so I can open a new sub-file, INVBOX66.BKS,
for the next box to be inventoried.  Once the sub-file is
recorded into the main file, AND YOU HAVE VERIFIED THAT IT IS
INDEED THERE, you can erase the subfile from the working disk.

Now here comes the part that shows you how really chicken I am. 
Since I have a hard disk, I do my work on the hard disk (Drives
"A" or "B".)  It is a lot faster to use the hard disk rather than
the floppy.  I am less likely to run out of space.  I keep a
floppy disk in Drive "C", using the "O" command from the main
Wordstar menu.  It will ask me if I want to overwrite the
existing file, C:INVENTOR.BKS.  With fear and trembling in my
heart, I hit the "Y" (for "YES") and let it do its thing.  Only
when I check the final result on the floppy, calling up the file
C:INVENTOR.BKS, and find that Box #65 is indeed listed, do I give
a sigh of relief, and go on with the next sub-file for Bos #66.

Actually, if you know how big the main file was before the
addition, all you really have to check is that the size of the
sub-file has been added to the size of the main file.  To some
"Doubting Thomases", seeing's believing.  I look for Box #65 at
the end of the main file before I erase the sub-file from my hard
disk.  

A word of WARNING!  Don't do work on a file that is going to be
longer than half the space left on the disk.  This means 195K
maximum, when starting with a freshly formatted empty floppy DSDD
disk.  Do your work on a separate disk, and keep adding the short
sub-files to the main file if it is to exceed half the available
space.  You can always copy a file, using the PIP commands, or
using the "O" in Wordstar, to fill a whole disk of 380+ bytes,
but you can't make changes on that disk and save them if the file
length is more than half the capacity of WHAT IS LEFT on that
disk.
