HP3000-L Archives

July 2000, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Boyd <[log in to unmask]>
Reply To:
Mark Boyd <[log in to unmask]>
Date:
Mon, 17 Jul 2000 11:05:51 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (87 lines)
Because of the way secondaries are stored, you will reduce the number of
secondaries you encounter if your serial read is backwards rather than
forwards.

-----Original Message-----
From: Ted Ashton [mailto:[log in to unmask]]
Sent: Monday, July 17, 2000 11:05 AM
To: [log in to unmask]
Subject: Re: [HP3000-L] How to delete unused entries...

Thus it was written in the epistle of Wirt Atmar,
> Tom writes:
>
> > >You're probably right, but I still don't like relying on a negative,
I'd
> >  >rather rely on a positive.
> >
> >  I agree!
>
> As long as I'm in a "disagreeable" mode of late, let me disagree with Tom
too.
>
> When it gets down to the nitty-gritty, the code that you would have to
write
> to engage the "positive" test is bound to be exactly identical to the
> "negative" code that exists now: a test would have to be made to see if
the
> chain length of the particular datavalue in the manual master is zero or
not.
> If it is, then the entry can be safely deleted. If it isn't, then it
can't.

The code *I* have to write actually is much shorter for the "negative" than
for the "positive".  Unless I've misunderstood something (and the code is
as-yet untested, so that's likely :-), the positive test, with care taken
for
migrating secondaries is something like this:

  rewind dataset
 +serial read on master
  if not finished yet
   *find on detail
    if not found
      delete master record
      if that was a primary with secondaries
        reread master record (mode 1)
        loop to *
      otherwise
        loop to +
    otherwise
      loop to +

For the negative, with the same care for secondaries:

  rewind dataset
 +serial read on master
  if not finished yet
   *delete master record
    if that was a successfully deleted primary with secondaries
      loop to *
    otherwise loop to +

Perhaps I haven't the right psychology, but that seems like a considerable
difference.  Frankly, it shouldn't make a lot of difference to the CPU, as
most of the records will go around the DBGET/DBFIND loop in the first one,
but it will make a significant difference on the actual deletes and much
cleaner, if less intuitive code.

I'll grant that it's uncomfortable to depend on the delete failing, sort of
like executing criminals by making sure that the non-criminals have
bulletproof
vests and the serially shooting everbody but as the non-criminals always do
have bulletproof vests and I have an inexhaustible supply of bullets it
should
be much more efficient than checking everyone's drivers license and only
shooting the ones who need to be shot.

Ted
--
Ted Ashton ([log in to unmask]), Info Sys, Southern Adventist University
          ==========================================================
We often hear that mathematics consists mainly of "proving theorems." Is a
writer's job mainly that of "writing sentences?"
                        -- Rota, Gian-carlo
          ==========================================================
         Deep thoughts to be found at http://www.southern.edu/~ashted

ATOM RSS1 RSS2