Batch control is a special feature of the LANSA Repository. Batch control logic is used to define the logic by which a numeric column in one table is totaled into the column of another table. LANSA's batch control logic automatically maintains the control totals in tables for you as records are inserted, updated and deleted. (The columns used in batch control can include key columns.)
Batch control is often used as a means of verifying totals during data entry. For example, batch control could be used to maintain an order header table with a column which stores the total value of a given order. This column is calculated by adding up the order amounts from each of the order lines for the specified order. Batch control could also be used to keep track of the total number of lines in a given order.
Batch control logic in tables can improve performance by reducing the amount of database I/O. It also simplifies application logic by centralizing calculations and performing them automatically. Batch control logic is defined at the table level. LANSA implements batch control using its Object Access Modules (OAM).
Functions equivalent to batch control can be performed using table level triggers. Though the trigger approach requires manual coding of the trigger functions, the ability to manually code the application logic makes the trigger very flexible and very powerful. Triggers are the recommended approach for implementing batch control type logic.
Important: Please note that the use of batch control logic, and the repository columns used to support it, may not be consistent with the practices of logical data modeling.
Following is an example of batch control:
When setting up the definition of the "Entry data" table in this example, the batch control logic component would be used to indicate that:
Following is another, simpler example. An order header table and an order lines table have the following columns defined in them: