Previous Topic: Performing Administrative TasksNext Topic: Editing Trigger Functions


Creating Trigger Functions

You can create a Trigger Function by specifying either "Trigger Function" or "TRGFUN" for the Function Type, in exactly the same way that you would create any other CA 2E function. When you enter a Trigger Function using the Action Diagram Editor (ADE), you can include any processing that you would include in any other non-interactive function (including calling any other non-interactive function). You have access to all the *Trigger Control Data and ORF parameters as input-only, and the NRF and return code parameters as input/output.

When you create a Trigger Function (TRGFUN), the CA 2E model automatically creates a file-specific parameter list for the function. The Trigger Router passes the list to the function as follows:

  1. Return code.
  2. Trigger Control Data structure (from the *Trigger Control Data system file).
  3. Old record format (ORF) structure (from the owning file).
  4. New record format (NRF) structure (from the owning file).

The Trigger Control Data structure contains fields retrieved from the parameters passed by Data Management to the Trigger Router, as well as some derived fields, as follows:

Field

Description

*Trigger File

Database file being updated

*Trigger File Library

Library of database file being updated

*Trigger File Member

Member of database file being updated

*Trigger Event

Database change event which caused trigger to fire

*Trigger Time

Trigger time relative to database change

*Trigger Commit Level

Commitment control level of database file being updated

*Trigger Timestamp

Timestamp of trigger firing

*Trigger Record Length

Length of database file record format

*Trigger Job Name

Name of job which updated database file

*Trigger Job User

User of job which updated database file

*Trigger Job Number

Number of job which updated database file

*Trigger App Program

Program which updated database file

*Trigger App Library

Library of program which updated database file

Note: The *Trigger Job fields are included to allow asynchronous Trigger Function calls to determine the name of the job that actually changed the database file, rather than using the job fields from the Trigger Server. The *Trigger App Program and *Trigger App Library fields allow Trigger Functions to make processing decisions based on the application program that caused the file change. In r 8.1, the *Trigger App Library is not currently used and is passed as blank to the Trigger Function.