IBM Books

Administration and Programming Guide for OS/400

Specifying COMMIT and ROLLBACK in a Transaction

In a non-persistent macro, a commit or rollback is done implicitly by Net.Data at the end of the macro invocation based on the success or failure of the invocation. With persistent macros, the commit or rollback is now done at the end of the transaction. However, because a transaction can span many macro invocations, you might want to commit or rollback changes incrementally within the transaction.

To commit pending changes during a transaction:

Specify the DTW_COMMIT() built-in function.

This function does not take any parameters and executes all changes pending in the transaction.

For example:

%html (report) {
@dtw_accept(handle)
...
%IF (action="Enter")
 @dtw_commit()
%ENDIF
 
%}

To rollback pending changes in the transaction:

Specify the DTW_ROLLBACK() built-in function.

This function does not take any parameters and backs out all changes pending in the transaction.

For example:

%html (report) {
@dtw_accept(handle)
...
%IF (action="Cancel")
 @dtw_rollback()
%ENDIF
 
%}


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]