Batch control logic (even though it is not always referred to by that name) is common. Some examples of its use are:
|
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.
|
In this structure TOTDUE (in order header) is a count of all associated VALUE fields in the order lines file. i.e. TOTDUE is the total value of all associated invoice lines.
In either of these cases the batch control component of LANSA can be used to automatically maintain the "control totals" in the other files.
When setting up the definition of the "Entry data" file in the first example, the batch control logic component would be used to indicate that:
When the I/O module for the "Entry data" file is compiled (see elsewhere for a description of I/O modules) it will contain logic to automatically maintain the batch control fields in the "Batch totals" and "Daily totals" files.
This means that whenever a record is added, updated or deleted from the "Entry data" file the totals will be maintained. No other logic is required to maintain the totals.
The logic generated will handle changes to the batch control "keys" as well. Thus even if a record in the "Entry data" file was changed from BATCH 1234 to 4567 and DATE 010187 to 150187 the control totals will be maintained correctly.
If a user creates a function to add records to the "Entry data" file it will use the I/O module. The I/O module will maintain the batch control totals in the other 2 files without the user even knowing of their existence.
The actual procedure for specifying batch control logic is described in the following sections.