Hi Chuck -
On Tue, 07 Jan 2014 13:39:23 -0800, CRPence <CRPbottle@xxxxxxxxx>
True, but that ignores the subtle\unstated implication that
Mohammed's _read_ was per use of effective WITH NC [no isolation], thus
effecting a /dirty read/ of Abdul's update using isolation. As such,
although Mohammed's request to effect the change was _momentarily_
/blocked/ awaiting the record lock on ITEM='X' [per WAITRCD() setting],
still he would have been able to set the value of UNITS=UnitsRead-5
within the program, to reflect that he had sold five units, thus
reducing the total number of units that was just read into his program;
i.e. 500=>(500-5)=>495. Then his update operation completes [with data
set from the buffer; i.e. UNITS=495] after the ROLLBACK releases the
lock; of course, if not exceeding the wait-time for the record lock. So
unfortunately for their failure to both participate with isolation to
prevent dirty reads, the number of units of ITEM='X' henceforth would
reflect a value of 83 more than actually exist... perhaps arising from
Abdul realizing that the shipment of new items were not ITEM='X'
irrespective of markings, and having since decided they will be returned
to the manufacturer, he rolls back his change [just before Mohammed made
and updated the effect of his sale].
This isn't specific to committment control The same thing can happen
if Mohammed reads a record with no lock and some other program
actually does an update of the record before Mohammed reads the record
again for update.
If a program reads a record without a lock with the intent of doing an
update to that record later, it's the responsibility of the program to
handle any intervening changes to the record image, regardless of how
said changes occurred.
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.