Batch Control Examples

LANSA for i

Batch Control Examples

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

Example 1

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

File name:

 

DAYTOT

BCHTOT

ENTDTA

Description:

 

Daily totals

Batch totals

Entry data

Fields:

 

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 file ENTDTA (Entry data):

File Definition Name

Batch Cntl File Name

Linked Fields In This File

Linked Fields In Cntl File

Keys To Access Cntl File

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 file that were defined as follows:

File name:

 

ORDHDR

ORDLIN

Description:

 

Order header

Order lines

Fields:

 

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 fields in the order lines file. 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 file ORDLIN (order lines):

File Definition Name:

ORDLIN

Batch Control File Name:

ORDHDR

Linked Fields In this File:

VALUE

Linked Fields In Control File:

TOTDUE

Keys to Access Control File:

ORDNUM