Here are a few guidelines to improve the efficiency of database transaction processing procedures:
If you are doing extensive calculations with variables and you do not need to take advantage of undo processing for those variables, use the NO-UNDO option when defining the variables.
If you are processing array elements, process them in a DO WHILE block rather than in a REPEAT WHILE block. That way, you will not start a separate database transaction or subtransaction for each array element.
When the logic of your application permits, do as much processing as possible directly at the database transaction level rather than creating subtransactions. This principle should not restrict the way you implement your application, but you should use it whenever it is convenient.