Copying records into files that use trigger programs

 

Triggers enable you to perform copy actions automatically when a specified change operation occurs.

A trigger program is a program that contains a set of trigger actions. A trigger action is a set of actions (high-level language statements, SQL statements, or i5/OS® utilities) that are performed automatically when a specified change operation (trigger event) occurs on a specified table or file.

If records are copied to a physical file that has an *INSERT trigger program associated with it, the trigger program is called each time a record is copied to the file. The trigger program is not called if deleted records are copied. If an error occurs while the trigger program is running, the copy operation fails. However, records that were successfully copied before the error occurred remain in the to-file.

If a from-file has a trigger program associated with it, the CPYF and CPYFRMQRYF commands do not copy the trigger information to the to-file when the CRTFILE parameter is used.

 

Parent topic:

Adding, replacing, and updating records (MBROPT parameter)

 

Related concepts


Adding, replacing, and updating records (MBROPT parameter)

 

Related information


Triggers
Database programming