T
Tim Kuehn
Guest
What you're asking is doable, but it'd be kludgy as heck and potentially hard to follow. I'd much prefer a solution which creates results in a set of TTs, and when all is "Well and good" save the TTs off to their respective db tables or ditches them if things don't work out. It'd look something like the following code, with "order" and "orderline" creation following a similar structure to the "createcustomer" procedure. outer-block: DO TRANSACTION: run CreateCustomer(ouput isOk). if not isok then undo, leave outer-block. run CreateOrder(output isOk). if not isok then undo, leave outer-block. run CreateOrderLine(output isOk). if not isok then undo, leave outer-block. if isSomeOtherFailureCondition then undo, leave outer-block. END. /* otherblock */ PROCEDURE CreateCustomer: DEFINE OUTPUT PARAMETER isOk AS LOGICAL NO-UNDO. DEFINE BUFFER Customer FOR Customer. work-block: DO TRANSACTION: /* Tx Start */ /* Create customer stuff */ IF isFailCondition THEN DO: ASSIGN isOk = NO . UNDO, LEAVE work-block. END. ASSIGN isOk = YES. END. /* Tx End */ END PROCEDURE.
Continue reading...
Continue reading...