Progress
Programming
Handbook


Making a Transaction Smaller

Now suppose that once you have EXCLUSIVE–LOCKed the order record at the start of the outer REPEAT block, you want to release that lock as quickly as possible (before the end of the block) so that other users can access that order record. You also want to release the SHARE–LOCKs on the item records as soon as possible You can do this by simply making the transaction smaller, as shown in Figure 13–7.

p-txn10.p

Figure 13–7: Making Transactions Smaller

Progress starts a transaction for each order and also for each order–line you enter. When you insert an order record at the start of the outer DO TRANSACTION block, Progress EXCLUSIVE–LOCKs that record. Progress releases that EXCLUSIVE–LOCK at the end of the transaction, which is at the end of the DO TRANSACTION block.

Now, other users can access the order record while you update order–line records. Each iteration of the REPEAT TRANSACTION block is a transaction. That means that the CREATE statement EXCLUSIVE–LOCKs the order–line record. Progress releases that lock at the end of the REPEAT TRANSACTION block, making the order–line record available to other users.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095