Batch Control Examples

These examples apply to defining batch control logic within a table definition.

Example 1

The "batched transaction" data entry application example used at the beginning of this section has three control tables that were defined as follows:

Table name:

 

DAYTOT

BCHTOT

ENTDTA

Description:

 

Daily totals

Batch totals

Entry data

Columns:

 

DATE

DDEBIT

DCREDIT

DATE    

BATCH

BDEBIT

BCREDIT

DATE

BATCH

TRANSACTION

ACCOUNT

DESCRIPTION

DEBIT  

CREDIT

Primary key  1

DATE

DATE

DATE

2

 

BATCH

BATCH

3

 

 

TRANSACTION

 

 

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.

To define this particular batch control logic requirement to LANSA the following batch control logic details should be added to the definition of table ENTDTA (Entry data):

Definition Name

Batch Cntl Table Name

Linked Columns in this table

Linked Columns in Cntl Table

Keys to Access Cntl Table

ENTDTA

BCHTOT

DEBIT

BDEBIT

DATE

CREDIT

BCREDIT

BATCH

ENTDTA

DAYTOT

DEBIT

DDEBIT

DATE

CREDIT

DCREDIT

 

 

 

Example 2

The second example at the beginning of this section dealt with an order header and order lines table that were defined as follows:

Table name:

 

ORDHDR

ORDLIN

Description:

 

Order header Order lines
Columns:

 

ORDNUM

CUSTNO

DATE

TOTDUE

ORDNUM

ORDLIN

PRODNO

QUANTY

VALUE

Primary key  1

ORDNUM

ORDNUM

2

 

ORDLIN

3

 

 

 

 

In this structure TOTDUE (in order header) is a count of all associated VALUE columns in the order lines table. i.e. TOTDUE is the total value of all associated invoice lines.

To define this particular batch control logic requirement to LANSA the following batch control logic details should be added to the definition of table ORDLIN (order lines):

Table Definition Name:

ORDLIN

Batch Control Table Name:

ORDHDR

Linked Columns In this Table:

VALUE

Linked Columns In Control Table:

TOTDUE

Keys to Access Control Table:

ORDNUM