3 16 1 How Batch Control Logic is applied

LANSA for i

3.16.1 How Batch Control Logic is applied

Batch control logic (even though it is not always referred to by that name) is common. Some examples of its use are:

  • A "batched transaction" data entry application may use a control file structure that looks like this:

Daily Totals

Batch Totals

Entry Data

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.

  • An order header and an order lines file have the following fields defined in them:

Order Header

Order Lines

ORDNUM

ORDNUM

CUSTNO

ORDLIN

DATE

PRODNO

TOTDUE

QUANTY

 

VALUE

 

 

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:

  • Fields DEBIT and CREDIT in the "Entry data" file should be accumulated by DATE and BATCH into fields BDEBIT and BCREDIT in the "Batch totals" file.
  • Fields DEBIT and CREDIT in the "Entry data" file should be accumulated by DATE into fields DDEBIT and DCREDIT in the "Daily totals" file.

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.