SIS Batch Header Utility

Many programs create data for entry to an SCT system through a batch maintenance utility. These data records must have a batch header record. Each batch header must have a unique identifier composed of (1) the batch identifier (6 characters) and (2) the batch date (mmddccyy format). This combination must be unique. This routine will use a batch identifier and batch date and will determine if it is unique. If not, it will attempt to find a unique batch identifier for the given date and will return it to the calling program.

The routine is only useable in Easytrieve Plus. There are two include members, and one DD statement is required in the JCL.

Include #1
The first include member is SI0900A. It contains the working storage fields and DB2 Declares necessary for the routines to work. It should be the last entry in your Files section (the last entry before your first Job statement).

This include uses an Easytrieve Plus Macro variable. This Macro variable is named SISVER and must be a Macro variable in the original program.

Include #2
This Include is named SI0900B. It does the actual work to determine if the batch header you are creating is unique. It takes two arguments:

The SI0900B Include is invoked as follows:

%SI0900B xxx yyy

where xxx is the variable containing the 6 character batch identifier and yyy is the variable containing the batch date.

Mechanics

This routine first looks at a specified transaction file. It searches it for a batch header that duplicates the one you are creating. If it finds a duplicate, it adds 1 to your batch identifier and searches again until it comes up with a unique batch identifier for the batch date specified.

Once this is done, it continues and looks and the SCT SIS file where previously processed batches are stored and performs the same process as described above.

Once these two processes are complete, the routine returns the batch identifier and batch date. The batch date will always be identical to what you specified. The batch identifier returned is what your program should use to insure it is unique.

JCL Requirements

This routine requires one addition to your JCL, namely:

//SISTRN DD DSN=xxx,DISP=SHR

where xxx is the dataset name(s) of the file(s) containing batch transactions waiting for processing. This file(s) is not updated in any way, but is opened and read several times. It must be present in your JCL.

SI0900 Example

A sample program (call it TEST01) might look as follows:


MACRO SISVER
FILE FILE01
   WBATCHID          W           006 A   VALUE 'CNV001'
   WBATCHDATE        W           008 A   VALUE '11241997'
  %SI0900A &SISVER

JOB INPUT NULL
  %SI0900B WBATCHID WBATCHDATE
  DISPLAY 'BATCH ID=' WBATCHID
  DISPLAY 'BATCH DATE=' WBATCHDATE
  STOP

This is a very simplistic example of use of the SI0900B routine. It will determine whether CNV001 is a unique batch identifier for 11/24/1997. If not, it will determine an appropriate batch identifier (WBATCHID) for the 11/24/1997 date that will make it unique. When run with test data on 02/04/1998, the batch identifier returned was CNV005.

The JCL required for this routine (step JCL only) would look similar to the following:


//TEST01   EXEC  EASYPLUS,ACCOUNT=ISP27,VER=TEST,TBLVER=PROD
//SISTRN   DD    DSN=AUP07.SIS.INST2.SISTRN,DISP=SHR
//SYSIN    DD    *
  %TEST01  'BASE'
/*

Limitations

This routine first searches the transaction file. Once that is complete, it searches the SIS ACRTTS DB2 table. If it makes changes based on what it finds in ACRTTS, it does not return to the transaction file to recheck it for uniqueness. As a result, there is a small chance that a batch identifier may still not be unique.

Technical

There is also an SI0900C module in Cobol. This module is called from the SI0900B Include. Its purpose is to search the SISTRN transaction file(s) to determine uniqueness of a batch identifier.

The checking of the ACRTTS table is done through Easytrieve Plus code that uses a SQL DECLARE CURSOR. The name of the cursor is BTCUR, which is defined in the SI0900A Include. It is this Include that uses the &SISVER Macro variable. This Macro variable contains the owner code of the DB2 ACRTTS table to be used, e.g., BASE, INST, TEST or PROD).