Page History
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:
A "batched transaction" data entry application may use three control tables structured like this:
|Daily Totals Table
Batch Totals Table
Entry Data Table
DATE
DATE
DATE
DDEBIT
BATCH
BATCH
DCREDIT
BDEBIT
TRANSACTION
BCREDIT
ACCOUNT
DESCRIPTION
DEBIT
CREDIT
- In this structure, BDEBIT and BCREDIT are totals of all DEBIT and CREDIT values for a particular DATE and BATCH.
- Likewise, DDEBIT and DCREDIT are totals of CREDIT and DEBIT values for a particular DATE.
...
Following is another, simpler example. An order header table and an order lines table have the following columns defined in them:
Order Header Table | Order Lines Table |
|---|---|
ORDNUM | ORDNUM |
CUSTNO | ORDLIN |
DATE | PRODNO |
TOTDUE | QUANTY |
VALUE |
|
- In this structure, TOTDUE (in order header) is a count of all associated VALUE columns in the order lines table. TOTDUE is the total value of all associated lines in the order.
See Also
...
Batch Control Examples
&<img src="../resources/images/opentoc-dark.png" title="Open Contents List" border="0"&>