Waiting on lock.....

Pickering, John (NORBORD) PICKERIJ@norbord.com
Wed, 5 Mar 2003 12:47:54 -0500


So what happens if something goes wrong in the Update procedure? Aren't you
left with the flag of m-lock set to the locked position indefintely?

-----Original Message-----
From: Peter Bateman [mailto:shediac92@hotmail.com]
Sent: Wednesday, March 05, 2003 12:38 PM
To: reasegurator@ole.com; esh78@rediffmail.com
Cc: powerh-l@lists.swau.edu
Subject: Re: Waiting on lock.....


Daniel:


I like your solution. I suspect that you are using the Image master file to 
"gate" the more complex processes.

Regards,
Peter


>From: Daniel Rodriguez <reasegurator@ole.com>
>To: Esh I <esh78@rediffmail.com>
>CC: powerh-l@lists.swau.edu
>Subject: Re: Waiting on lock.....
>Date: Wed,  5 Mar 2003 08:37:36 +0100
>
>We use a master file with a flag to set the lock.
>In the PREUPDATE procedure you look if the flag in the master file is set 
>to 1
>(lock). If this hapend, you can do what you want. If it's 0 you put it to 
>1. In
>the postupdate procedure you must put the flag to 0 again. I'm not very 
>fluent
>in english so i prefer to write you some code...
>
>PROCEDURE PREUPDATE
>BEGIN
>   GET M-LOCK VIA C-INDEX USING "index-1" OPT
>   IF ACCESSOK
>   THEN
>     BEGIN
>       IF FLAG OF M-LOCK = "1"
>       THEN
>        BEGIN
>;         ......
>        END
>       ELSE
>         BEGIN
>           LET FLAG OF M-LOCK = "0"
>           PUT M-LOCK RESET
>         END
>     END
>   ELSE
>     BEGIN ;If this flag doesn`t exist
>       LET C-INDEX        OF M-LOCK = "index-1"
>       LET FLAG           OF M-LOCK = "1"
>       LET DESCRIPTION    OF M-LOCK = "Flag for......."
>       PUT M-LOCK RESET
>     END
>END
>
>;---------------------------------------
>
>PROCEDURE POSTUPDATE
>BEGIN
>   GET M-LOCK VIA index USING "index" OPT
>   IF ACCESSOK
>   THEN
>    BEGIN
>     LET
>    END
>END
>
>Mensaje citado por Esh  I <esh78@rediffmail.com>:
>
> > In my program i have set a lock on one of my files. When run
> > concurrently i dont want my program to wait on that lock and
> > display an error message once the wait time expires. Rather i
> > would like my program to do something else once it finds that the
> > required file has been locked.
> > Can i make this happen?
> >
> > Thanks
> > Esh I
> >
> > = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> > Mailing list: powerh-l@lists.swau.edu
> > Subscribe: "subscribe" in message body to 
>powerh-l-request@lists.swau.edu
> > Unsubscribe: "unsubscribe" in message body to
> > powerh-l-request@lists.swau.edu
> > http://lists.swau.edu/mailman/listinfo/powerh-l
> > This list is closed, thus to post to the list you must be a subscriber.
> >
> >