COMMIT
The COMMIT statement causes an immediate commit of all changes made to the tables stored within an RDBMS. All record locks are forfeited.
••••• COMMIT
(1)
The COMMIT MODE predefined field determines if and when APPX commits your changes automatically. It is initially set based on the Commit Mode specification from your process (in Additional Attributes) but can be modified. If you change COMMIT MODE, the change will take affect at the next COMMIT or ROLLBACK.
Based on the structure of your application, there may be other places where you want to COMMIT a transaction. That's what the COMMIT statement is for. One thing to keep in mind is that the frequency of COMMITs will affect performance. The more COMMITs you do, the slower your application will be. For interactive processes, you can probably ignore the performance issue, but for batch-mode operations, COMMITing too often can really slow things down.
Another issue to be aware of is that APPXIO files do not support transaction processing. If you ROLLBACK a change to an RDBMS-hosted file, any changes made to APPXIO will not be rolled back. Related to this is the issue of visibility. Changes made to an RDBMS-hosted file are invisible to other users until they are committed. Changes made to an APPXIO-hosted file are visible immediately.
In the following example, if the flag indicates it is OK to commit, the COMMIT takes place and processing continues. Otherwise, changes made since the savepoint designated as TRX POINT 1 are discarded and the program branches to an applicable routine.
SAVEPNT TRX
POINT 1
*
<perform
RDBMS processing>
*
IF TAR
WORK OK TO COMMIT NE Y
T ROLLBACK TRX
POINT 1
T GOTO :TRX
POINT 1 STATUS
COMMIT