What happens when a Database Trigger is executed?

1.  A database management program calls the DB Trigger program.

2.  If the I/O is from LANSA the DB Trigger program returns.

3.  If this is the first time for the program, the trigger environment user exit program (DCTRGENVUE) is called.

4.  The LANSA environment is established.

5.  The OAM is called to carry out any validation rules and / or call any LANSA trigger functions. In addition, for before insert and before update processing, the value of the special @@UPID field for LANSA defined tables is enforced to be 1 for before insert and incremented by 1 for before updates. Also those two trigger time and events will cause stamp output attribute fields to be filled in.

6.  If LANSA is configured to replace the library list on exit from LANSA (specified in the Replace library list on exit from LANSA option described in the Execution and Security Settings of the LANSA for i User Guide), the job library list is set back to what it was when the Database Trigger program was called. Otherwise the LANSA libraries are left in the job library list, and it is assumed that they will be there for subsequent calls of the Database Trigger program.