locked()

Kenneth Brody kenbrody at spamcop.net
Thu Feb 25 09:48:51 PST 2016


On 2/25/2016 11:17 AM, Richard Kreiss wrote:
> My client has a report which does a getnext on a lookup file.
>
> In simple terms, will locked() work after a getnext?
>
> Currently the lookup is:
> ::lookup foo = foobar  k=10  i=b -bx
> : not foo:END
>
> Would the follow work?
> lookup foo = foobar  k=10  i=b -npxw
> Not foo:end
> Proc:foo(1) ge "30" and foo(1) le "45"
> 	getnext foo; GOTO proc (current code)
>
> Proc:foo(1) ge "30" and foo(1) le "45"
> getnext foo
> If: 	locked(foo) (would locked work after a getnext?)
> 	getnext foo;GOTO proc
> ::hi=hi+foo(5)
> Process does a lot of math using dummy fields and then loop back to PROC.
>
> TEST:foo(2) ne 10:END
> ::goto proc

I'm not sure if the "locked()" test will work on a getnext, though I don't 
see why it wouldn't.  (It's easy enough to set up a quick test.)

What I can tell you is that, if the getnext fails because the record is 
locked, you can't then do another getnext to go past it.  (Remember, using 
"-p" and "-w" means the lookup will fail if the record is locked.  You can't 
"getnext" a failed lookup.)

I would strongly recommend using a "normal" lookup for the getnext, and a 
separate "-pw" lookup through which you modify the record.

-- 
Kenneth Brody


More information about the Filepro-list mailing list