Undo record creation

Luc Lessard

New Member
Hi All,

I want to undo the record creation in test.p because a
error (did not pass validation) in test2.

The real programs are creating multiple record in multiple
table.

I just want to know if it is possible do undo wath is done
in a another programs when you come back to the calling
one.

A do transaction on top of Programs A does undo the record
creation in calling programs ?

I do not want to make my programs A the intire transaction ??
To may table will be lock.

/*****************
Programs A:

Prog:
Repeat:

do:
run test.p.
end.

run test2.p.

End.
******************/

/*********************
test.p:

create bidon.
assign bidon.qty = 9999.
*********************/

/*************************
test2.p:

validation not pass.
undo, leave.

create bidon2.
assign bidon2.inv-num = 1111.
*************************/

TIA.
 
It isn't possible to undo what has been done in program test.p unless it is part of a transaction that is still current.

The solution is to perform validation *first* and the update in one transaction. If you need to create records in test.p create them as temp-table records and only apply them to the DB (using a buffer-copy statement) when all validation has been done.
 
Top