Re: Locking Problem with Online Support.
Posted in 1996
There is a section in the FAQ at http:\\\\www.iiug.org on the status and isam codes related to locking. It also seems like you are trying to lock something wile a user shall enter some data. You most certainly shouldn't do that. That is very bad programming practise. In 99.99% or more of the cases where you first think this is necessary you can program around it by optimistic locking. One way is to read the data first without locking them and store them in program variables. Then let the user do his changes. Then read and lock the data again, compare them with the data you read before the user entered his data. If they are the same you can safely update/insert, otherwise you do anything appropriate to the situation. In this way you avoide problems with keeping locks while the user is entering data (or while the user goes to lunch and have the data locked). 106005.3077@compuserve.com (John Brownlee) wrote: :Morning All, :I have a problem where a certain section of Code used for Locking works ok :on Standard Engine 5.06 (-250), :but on On-Line experiences a problem, as it gets a different Error Code :returned, looking at the ISAM code :of this new error code (-243 on Online) it indicates a locking problem. :How many other error codes out represent :a locking problem ?? How come the detection of a locking problem in :Standard Engine does not work on Online ?? :Any suggestions or help would be appreciated. :Please find enclosed section of locking code :- : LET g_error = -250 : : WHILE g_error = -250 : : WHENEVER ERROR CONTINUE : : CLOSE s01_daily_paymts : : OPEN s01_daily_paymts : : FETCH s01_daily_paymts INTO f_c_daily_paymts.* : : : : LET g_error = STATUS : : WHENEVER ERROR STOP : : IF g_error = -250 : : THEN : : MESSAGE "Record currently lock by another user, please wait :..." : SLEEP 1 : : MESSAGE " " : : SLEEP 1 : : ELSE : : END IF : : END WHILE : : : : IF g_error != 0 : : THEN : : LET p_error_desc = "Unable to lock Payment Advice for Transfer" : : LET p_key_data = f_c_daily_paymts.advice USING "<<<<<<<", ", ", : : f_c_daily_paymts.contract_no : : CALL serious_error ( g_error, p_module, p_version, : : p_error_desc, p_key_data ) : Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org