Embedded Basic Subroutines
An Embedded Basic subroutine is a cataloged subroutine that is called automatically by Reality in response to a pre-defined action. Embedded Basic subroutines are of two types, file triggers and dictionary subroutines.
File triggers
A file trigger is called whenever an item is created, updated or deleted in a particular file. A trigger can be set to run before or after an item is written, or before or after an item is deleted.
Triggers that run before file operations are typically used to validate the attempted change to the database against user-defined constraints, or 'business rules', and allow the change only if the constraints are satisfied.
Triggers that run after file operations are typically used to create audit trails and other transaction logs.
All types of trigger can be used to create relationships between files, to ensure that whenever one file is updated, another related file is also updated.
Note
Triggers are only run when individual items are created, updated or deleted. They do not run when a complete file is cleared or deleted (for example, with the CLEARFILE statement or the DELETE-FILE command).
Dictionary subroutines
A dictionary subroutine is one that can be called as part of an English query using the CALL conversion code. The call can be included in the conversion codes attribute of a File Definition Item, or in the input/output or pre-processor conversion attributes of a Data Definition Item (see also Conversion Codes).
Note
You can also use the CALL conversion code in the DataBasic ICONV and OCONV functions.
A dictionary subroutine can also be used as a replacement for a user exit - this feature is primarily intended to provide compatibility with other MultiValue systems.
See also
How to Write an Embedded Basic Subroutine
Embedded Basic Examples
Debugging Embedded Basic Subroutines
How to Associate a Trigger with a File
Triggers Dos and Don'ts