WEBSITE FOR SYNON DEVELOPERS
Synon Mainframe Refresher
 

Trigger Function

The CA 2E 'Trigger Function' allows you to specify an HLL program using A CA 2E action diagram.
The function is implemented as a separate program which can be called from the CA 2E Trigger Router program YTRIGGER when a file change is made ad a trigger has been added to the file specifying that the trigger program is YTRIGGER.
Trigger Functions are defined with a specific parameter list which cannot be changed. The parameters are as follows:

1: Trigger Control Data : This parameter is defined as the *Trigger Control Data internal file and contains information about the trigger itself (trigger time, trigger event, trigger file etc.). The fields within this RCD parameter are input only.

2: Old Record Format : This parameter contains a copy of the record format of the file over which the trigger is created. The fields contain the data for the record format BEFORE the file change takes place. If the trigger event is a *INSERT event, the fields in this RCD parameter will be blank/zero. The fields within this parameter are input only.

3: New Record Format : This parameter contains a copy of the record format of the file over which the trigger is created. The fields contain the data for the record format AFTER the file change takes place. If the trigger event is a *DELETE event, the fields in this RCD parameter will be blank/zero. If the Trigger Function is called as part of a *BEFORE *INSERT or *BEFORE *UPDATE trigger operation, changes to this parameter will be reflected in the record that is written to/updated in the database.

The 'Trigger Function' is designed to be called by the CA 2E Trigger Router program YTRIGGER when a database change (delete, insert or update) occurs and the database file has a trigger attached where the specified trigger program is YTRIGGER. Trigger Functions can contain any processing that you might find in an Execute External Function (EXCEXTFUN) except that they should not contain any calls to any database functions (CHGOBJ, CRTOBJ, DLTOBJ or RTVOBJ) for the file over which the Trigger Function is built.