Hi Tom,I was wrong. I forgot that the whole thing is inside a transaction scoped to the procedure block.
So, in this case, you aren't seeing a SHARE because of the transaction scoped to the procedure -- it encloses the strong scoped sub-transaction and thus there is no downgrade because a TRX is still active.
This stuff is tricky. Transactions scoped to procedures are bad, bad, bad.
Yes, I did to see whether any _LOCK entry is there or not at message 2, but there is nothing. If we use UPDATE it is there with EXCL if we don't use any UPDATE outside DO block then no entry in _LOCK. If there is no entry in _LOCK at message 2, why it's even available in SHARE-LOCK which allows it to update and upgraded to EXCL.Your example above is missing the UPDATE that causes a transaction to be scoped to the procedure.
./trans.p 06/29/2014 10:00:56 PROGRESS(R) Page 1
{} Line Blk
-- ---- ---
1 def buffer bcust for customer.
2 find customer where customer.custnum = 10 no-lock.
3 1 do for bCust transaction:
4 find bcust where bcust.custnum = 10 exclusive-lock no-wait no-erro
4 1 r.
5 1 bcust.name = "Strong Scope".
6 end.
7 update customer.name.
^L./trans.p 06/29/2014 10:00:56 PROGRESS(R) Page 2
File Name Line Blk. Type Tran Blk. Label
-------------------- ---- ----------- ---- --------------------------------
./trans.p 0 Procedure Yes
Buffers: s2k.Customer
Frames: Unnamed
./trans.p 3 Do Yes
Buffers: s2k.bcust
After thinking about it I came to the conclusion that it is a dangerous thing to have more than one buffer that holds exactly the same record. Whenever you change the record in one buffer and write it back to the database the other buffers won't get refreshed and will still contain the versions of the same record at the time when it was read into the buffer. Therefore you will most likely end up with different version of the same record in different buffers.
One might think that this could be useful for some kind of before imaging - but I would strongly recommend to use temp tables for such a mechanism instead and thereby utilizing optimistic locking and transaction scopes that are as small as possible to ensure concurrency.
DEFINE TEMP-TABLE ttx NO-UNDO
FIELD xy AS CHARACTER.
DEFINE BUFFER b1 FOR TEMP-TABLE ttx.
DEFINE BUFFER b2 FOR TEMP-TABLE ttx.
CREATE b1.
B1.xy = 'ABC'.
VALIDATE b1.
FIND FIRST b2.
b1.xy = 'DEF'.
MESSAGE b2.xy
VIEW-AS ALERT-BOX INFO BUTTONS OK. /* prints DEF */
I have been horribly surprised to see this which coincidentally im trying from yesterday. But my problem is not what is expressed by many here. The only thing i know or knew to be true is strong scopes (DO FOR) in this case should not allow reference of the record/buffer of any kind outside. But from some version of OE, i can see strong scopes aint the way they used to be. It is allowing strong and weak scope in the same program and also strong scope is allowing records to be available outside for read/update.Does Record bleeding occur in version 11.3?
If not, I am not getting what's wrong with below code. It allows me to update NO-LOCK buffer customer.
Code:def buffer bcust for customer. find customer where customer.custnum = 10 no-lock. do for bCust transaction: find bcust where bcust.custnum = 10 exclusive-lock no-wait no-error. bcust.name = "Strong Scope". end. update customer.name.
...my problem is not what is expressed by many here.