How the system restores files with triggers

This topic provides information about how the system restores files with triggers.

You can define one or more trigger programs for a file. When a certain event occurs in the file, the system calls the trigger program. When you save a file that has trigger programs, you are saving only the definitions of the trigger programs, not the programs themselves. You must ensure that the programs are also saved, perhaps by placing them in the library with the file.

When you restore a database file that already exists, the system does not restore any trigger program definitions from the save media. When you restore a database file that does not exist, you should ensure that any definitions for trigger programs that were not on the saved copy are reestablished. Otherwise, you lose the data integrity checking that was on your system before a failure occurred.

The system does not stop restoring a database file if its trigger programs cannot be found. Therefore, you must ensure that files and trigger programs are saved and restored correctly. Otherwise, an error might occur.

Table 1 shows examples of actions the system takes when you restore the physical file FILEA and the trigger program PGMA:

Table 1. Restoring files that have trigger programs
Save procedure that is used Restore procedure that is used How the trigger program is defined after the restore operation
FILEA is saved from LIBX. PGMA is saved from LIBX. The trigger is defined as LIBX/PGMA. PGMA is restored to LIBY. FILEA is restored to LIBX. The trigger is defined as LIBX/PGMA. When an event occurs that causes this trigger, the program will not be found.
FILEA is saved from LIBX. PGMA is saved from LIBX. The trigger is defined as LIBX/PGMA. PGMA is restored to LIBY. FILEA is restored to LIBY. The trigger is defined as LIBY/PGMA.
FILEA is saved from LIBX. PGMA is saved from LIBY. The trigger is defined as LIBY/PGMA. PGMA is restored to LIBZ. FILEA is restored to LIBZ. The trigger is defined as LIBY/PGMA. When an event occurs that causes this trigger, the program will not be found.

The Journal management topic describes special considerations when you journal database files that have triggers defined. You must make special provisions to ensure the integrity of your data because trigger programs are not called when you apply journaled changes.