need help with dclerk

John Esak john at valar.com
Thu Sep 9 00:17:24 PDT 2010


I see that you found an answer that works.

I would like to submit a complete, working answer. Meaning, this will work
even there are NO records in the file.

To get to a record in clerk from @once, do some work and then leave without
adding any records to the file. I do it this way. This is a tried and true
method that does not screw up the freechain, or anything else.


First of all the command line is fine as you have it.

   Rclerk filename -z process -s0 -rx passed_to_ at px

Put this in the @once processing on the INPUT table of course. It can never
be on AUTOMATIC.


        If:
      then: end
@once   if; 
      then: declare recnum(8,.0,g)
        if:
      then: lookup cur_filename r=free
        if:
      then: recnum=cur_filename(@rn)
       if:
      then: write cur_filename
        if:
      then: lookup - r=(recnum)
        if:
      then: pushkey "u"
        if:
      then: end
@update if:
      then: 'Do anything you want here
        if:
      then: '...
        If:
      then: delete;  exit



You can do this a tiny bit easier if you could somehow be sure of a
particular record to "go stand on" that you were absolutely sure won't be in
update mode by some other process.  But, how can you ever be sure of this?
I mean obviously, doing a lookup - to a preset @rn is an easy thing to do,
but who knows if you will find it locked?  You need a record cretin to be
available. So, the theory above is to get a free record, grab it's record
number in a global variable.  Then, WRITe that record, which closes your
lookup, then move directly to that record using the newly retrieved recnum
and immediately pressing "u" which puts you into update mode. Update mode
has its own processing trigger. You guessed it, 2update... So you are ready
to do anything either to that record or to any other record you can lookup.

I have dabbled with the idea of putting the lookup - just *before* the
WRITE, but that introduces the problem that you already have the record open
from the first lookup.  So writing it first assures it ready for your use.
There is the infintesimally small possibility that something else will grab
this record before your locking it again with the "u" that you've pushed,
but it is a tiny prce to pay for keeping things "clean".  I've asked Ken if
there is a better way to do this entire process and we, jointly, could not
think of one.  There's always the chance he will look at this again now and
see a better way today, that could not be seen yesterday. Or another great
mind will consider the problem and divulge a way that is without "hassle".
I can tell all who might try, that doing a lookup dash to a newly "looked-up
free" record and then pressing "u" on it *might* work.. But it is fraught
with serious problems.  So, take another route if you are going to try and
better this approadh.

HTH

John





> -----Original Message-----
> From: filepro-list-bounces+john=valar.com at lists.celestial.com 
> [mailto:filepro-list-bounces+john=valar.com at lists.celestial.co
> m] On Behalf Of Fairlight
> Sent: Wednesday, September 08, 2010 9:48 PM
> To: filePro Mailing List
> Subject: need help with dclerk
> 
> I knew this about a year or two ago, but I really rarely use 
> clerk in an
> automated context, preferring report for my automated tasks, 
> specifically
> because it has the -sr flag to jump to a record and sit there.
> 
> Unfortunately, what we have is the need for processing to use 
> FORM, which
> doesn't work in report.  So clerk is a must-have on this one part.
> 
> We have processing that works.  It's in @ONCE processing.  It'll exit.
> It's -getting- to the @ONCE that's being problematic.  
> 
> Currently we have:
> 
>      dclerk database -s0 -z processingtable -rx passedvalue
> 
> The problem is that clerk hangs at the "Record Number, Scan 
> for Records,
> Add Records, etc." menu.  I added -xig to use index G, which gets me a
> little farther along, but prompts me for index data to search 
> for.  Tried
> adding -xe to drop to @ENTSEL, but that didn't actually work.
> 
> Honestly, I don't know how to drop straight to a record (ANY 
> record will
> do, seriously!) in clerk so that it executes the @ONCE 
> processing.  I know
> I'm missing something simple, but I can't remember it, and 
> neither can the
> actual fP programmer.  I figure I'll have the response here 
> in under an
> hour if I just ask, so I'm asking.
> 
> And no laughing!  :)
> 
> Thanks in advance!
> 
> mark->
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
> 



More information about the Filepro-list mailing list