REP007 - File Validation Rules/Triggers
Application business rules are centrally defined in the LANSA repository as validation rules either in the field or the file definition. Centralized field validations remove the need for developers to code the same validation into each program that uses the same file. A rule is checked when a database file operation (such as an insert, update or delete) is performed using the specified field(s).
Objectives:
- To highlight the difference between field and file level validation rules and the hierarchy which exists between these rules.
- To show how multiple rules can be defined for a field.
- To add the following business rules to file iiiDepartments:
iDeptCode |
Must be in range A to ZZZ |
- To add the following business rules to file iiiEmployees:
iiiDeptCode |
iiiDeptCode must exist in file iiiDepartments |
iiiSalary |
Must be less than 10000.00 |
To achieve these objectives, you will complete the following:
Step 1. Add a Rule to file iiiDepartments
Step 2. Recompile the File and Test Department Rules
Step 3. Referential Integrity Rule in iiiEmployees File
Step 4. Add Rules to iiiSalary Field
Step 5. Recompile the File and Test Employee Rules
Step 6. Complete Referential Integrity
Step 7. Know about File Level Triggers
Before you Begin
In order to complete this tutorial, you must have completed the previous tutorials.