PERFORM subr ON { {COMMIT [LEVEL idx]} | ROLLBACK }.
This statement registers the subroutine directly specified using subr in the same program. The subroutine is not executed immediately, but a flag is set for execution when one of the statements COMMIT WORK or ROLLBACK WORK (since Release 6.10) is reached.
The registered subroutines are executed if the statement COMMIT WORK
or ROLLBACK WORK is executed in their work process and
before update function modules registered using
CALL FUNCTION ... IN UPDATE TASK. Subroutines that are registered during execution of an update function module for COMMIT are executed at the end of the
update in the update work process.
... LEVEL idx
In the case of suroutines registered for COMMIT, the execution sequence can be controlled using the addition LEVEL, whereby for idx a data object of the type i is expected. The execution then takes place, sorted according to ascending value of idx. idx has the value 0, if a value is not explicitly specified. If the value is that same as idx or if there is no specification, the sequence of execution is the same as the registration sequence. A subroutine registered multiple times for COMMIT or ROLLBACK is executed once in each case.