Openedge transactions error-handling records are not rolled back in subtransaction

Status
Not open for further replies.
J

Jac

Guest
I have following code and try to do error-handling. But there is something wrong.

Routine–level throw error.

PROCEDURE Create-Subrecords :
For each db-table1 no-lock :
LABEL1:
For each db-table2 no-lock
on error undo, next LABEL1 :
For each db-table3 no-lock
on error undo, throw:
Create db-table4.
…..

End. /* db-table3 */
Run proc1. (Do some database updates on db-table2)

Catch e as progress.lang.apperror:
Msg = e:Getmessage(1). /* save message for later */
Undo, next LABEL1.
End catch.

End. /* db-table2 */
End. /* db-table1 */
End PROCEDURE.


The problem is that Proc1 returns an error that is catched by the catch statement. There I want to Undo all the work done in the transaction started by for each db-table2.

So I thought that all db-table4 records (created in a subtransaction started by for each db-table3) must be deleted. => but that is not the case, if I look in the db after my program is done all new db-table4 records are there.

What I am doing wrong? Because I want to roll-back (on error) everything that is started in LABEL1.

Thanks for help

Continue reading...
 
Status
Not open for further replies.
Top