creating usable records - warning: long question

Leefp1 at aol.com Leefp1 at aol.com
Sun May 30 11:51:29 PDT 2004


While working most of this weekend to correct a problem resulting from a VERY 
stupid action on my part (a long boring story), I again ran across a needed 
programming (or maybe system administration) strategy that I wonder how others 
handle.  I will give a simplified illustration.

If you wanted to post information to records in a file but you wanted to be 
able to select the record number to which you were posting (i.e. Not just to 
any free record), how would you do it.  

I have occasionally had this need.  When starting with an empty file it is no 
problem.  I would just add as many records needed and place an innocent 
character, like a period, in a field in each record; do my posting; then delete all 
the records that still only had a period as the only character in the record. 
 As a result, all my records are where they need to be and now empty records 
are available as free records for the future.

But this weekend I had a complication.  I was not starting with an empty 
file.  I had a file in which the highest record number was about 48000 but it had 
many empty (free) records throughout (resulting from deletions).  I needed to 
be able to post to record numbers up to 51000 as well as to some of the free 
records in the file.  I THOUGHT I could find out how many free records were in 
the file, and add that number to the difference between 48000 and 51000.  Say 
the number was 5000.  I thought I could then write a loop that for 5000 
iterations would find a free record in the file and place a period in a field in 
each record.  My assumption was that all of the free records below 48000 would be 
used as well as the necessary number above 48000.  But, to my surprise, SOME 
of the free records below 48000 were used but most were not.  I'm not sure why 
not.  My thought was maybe some of the records were not really "free," but 
even if I went to a given record number and deleted the record, my above 
technique did not produce a period character in the record.

So, my question from all this rambling...  What would be the best strategy to 
create usable records within a file to which one can post by specific record 
number?

Thanks for any advice for the future.

-Lee

BTW... finally this weekend, I copied the file to another name, deleted key 
and data files in the original file, created "period" records of sufficient 
quantity in the original file and then posted back from the new file and posted 
my needed info all to specific record numbers.

Also... I know that the reason I need to do such a thing is a mistake made 
many years ago to use record numbers as ID numbers under certain circumstances.  
I know it is not good programming, but it has not burned me very many times 
and to change now would not be worth it.
----------------------------------------
Lee B. Walker
Walker & Company
5307 Front Royal Drive
Cross Lanes, WV 25313
304.419.0013
lee at walkeronline.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.celestial.com/pipermail/filepro-list/attachments/20040530/d65f172a/attachment-0001.html


More information about the Filepro-list mailing list