Re: 4gl table locking
Posted in 1994
John Wade (wade@waterloo.hp.com) wrote: > Hello there, > I am a beginner at Informix and their 4gl. The version I have is 4.10. > The problem that I am trying to resolve is that using Informix's 4gl > and trying to lock a table in exclusive mode that is already locked > by another program. The second program that tries to lock the table > crashes out of the application back to UNIX. > My question is there any standard way of having a program wait gracefully > until the another program unlocks the table?. It seems that SET LOCK MODE TO > WAIt is only for record locking and not table locking. > Any suggestions? Any help is appreciated!!. > -=[ John Wade ]=- > wade@waterloo.hp.com Hello John, what you need to do is to use the WHENEVER ERROR CONTINUE statement before you try to lock the table. Look at the short example. This does work: +----------------------------------------------------------------------------+ database ews main define answer char(1) whenever error continue lock table test in exclusive mode if status = 0 then display "Table test locked..." prompt "Continue with <return>..." for char answer unlock table test else display "Error while locking (",status,")" end if whenever error stop end main +----------------------------------------------------------------------------+ Hope, this helps Dirch -- +----------------------------------------------------------------------------+ | Dirch Scheer email: scheer@stadt-mh.de | | Amt 10-3 Tel. : +49 208 455 1006 | | Stadtverwaltung (snail-)Mail : Ruhrstr. 32 | | Muelheim an der Ruhr D-45468 Muelheim an der Ruhr | |----------------------------------------------------------------------------| | Inspiration gave them the motivation to move on out their isolation | +----------------------------------------------------------------------------+