Progress
Programming
Handbook


Controlling Where Transactions Begin and End

You may find that, because of the kind of work a procedure does, you want to start or end transactions in locations other than those Progress automatically chooses. You know that Progress automatically starts a transaction for each iteration of four kinds of blocks:

A transaction ends at the end of the transaction block or when the transaction is backed out for any reason.

Sometimes you want a transaction to be larger or smaller depending on the amount of work you want undone in the event of an error. You can explicitly tell Progress to start a transaction by using the TRANSACTION option with a DO, FOR EACH, or REPEAT block header:

When you explicitly tell Progress to start a transaction, it starts a transaction on each iteration of the block regardless of whether the block contains statements that directly update the database. Of course, Progress does not start a transaction if one is already active.

You can also give a DO block the TRANSACTION property by using the ON ERROR phrase (DO ON ERROR:) if it also directly contains statements that update the database. DO ON ERROR is discussed later in this chapter.


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