In this section, you experiment with increasing the size of a transaction. To see the effect of removing the DO TRANSACTION block from saveOrder:
1. Comment out the DO TRANSACTION statement and the matching END statement at the end of the procedure.
2. Recompile and generate a new listing file.
3. Take a look at the final section. You can see that, without the DO TRANSACTION block, the entire saveOrder procedure become a transaction block:
File Name Line Blk. Type Tran Blk. Label
-------------------- ---- --------- ---- ------------------------------
...ter8\orderlogic.p 82 Procedure No Procedure fetchOrder
...ter8\orderlogic.p 111 For No
...ter8\orderlogic.p 124 Procedure Yes Procedure saveOrder
Buffers: bUpdateOrder
sports2000.Order
...ter8\orderlogic.p 146 Do No
...ter8\orderlogic.p 151 Do No
...ter8\orderlogic.p 156 Do No
...ter8\orderlogic.p 164 For Yes
Buffers: sports2000.OrderLine
bUpdateOline
Why did this happen? A DO block by itself, without a TRANSACTION or ON ERROR qualifier, does not start a transaction. Therefore, the AVM has to fall back on the rule that the entire procedure becomes the transaction block. In this particular case, this does not really make a big difference because the update code for Order and OrderLine is essentially the only thing in the procedure. But, as emphasized before, this is a very dangerous practice and you should always avoid it. If you generate a listing file and see that a procedure is a transaction block, you need an explicit transaction within your code. In fact, you should always have explicit transaction blocks in your code and then verify that statements outside that block are not forcing the transaction to be larger than you intend.