Database Rules

Rules define the way a business keeps track of its data. They apply only to update programs; they have no function in reporting programs. Rules can exist for a file, a state, or an event (referred to here as file rules, state rules, and event rules, respectively). The system structures the rules hierarchically. That is, file rules apply to all records in the file and all states and events defined in the file, state rules apply to all records in that particular state and all events defined in the state, event rules apply only to records in that event. These rules may apply globally across the entire file, or only to particular subtypes you have defined.

When an event causes multiple rules to be applied, all conditional rules, such as Field Relation or Required rules, must evaluate True; otherwise, no rules that modify the data take effect. If any conditional rule evaluates to False, the event terminates with an error message and the system discards any results of rules that modified data. See Field Relation for more information.

If you are using the Database Definition utility (dbdef) on IBM i , any additions or changes you make to database rules for a file have no effect. However, you can use the Database Definition utility (dbdef) to view the rules information for a file. Note that a program, after its source code was generated based on a particular file definition, could have been modified such that the program no longer reflects the original rules information.