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 HR9900A. 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 HRSVER and must be a Macro variable in the original program.
Include #2
This Include is named HR9900B. It does the actual
work to determine if the batch header you are creating is unique. It
takes two arguments:
The HR9900B Include is invoked as follows:
where xxx is the variable containing the 6 character batch identifier and yyy is the variable containing the 8 character batch date.
Once this is done, it continues and looks and the SCT HRS table where previously processed batches are stored and performs the same process as described above. HRS stores batch information in the HRS_BATCH_TB table (short name is EQRTTS).
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.
//HRSTRN 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.
MACRO HRSVER FILE FILE01 WBATCHID W 006 A VALUE 'JAE001' WBATCHDATE W 008 A VALUE '08271997' %SI0900A &HRSVER JOB INPUT NULL %HR9900B WBATCHID WBATCHDATE DISPLAY 'BATCH ID=' WBATCHID DISPLAY 'BATCH DATE=' WBATCHDATE STOP
This is a very simplistic example of use of the HR9900B routine. It will determine whether JAE001 is a unique batch identifier for 08/27/1997. If not, it will determine an appropriate batch identifier (WBATCHID) for the 08/27/1997 date that will make it unique. When run with test data on 02/10/1998, the batch identifier returned was JAE003.
The JCL required for this routine (step JCL only) would look similar to the following:
//TEST01 EXEC EASYPLUS,ACCOUNT=ISP32,VER=TEST,TBLVER=PROD //HRSTRN DD DSN=AUP03.hrs.INST.tran081,DISP=SHR //SYSIN DD * %TEST01 'INST' /*
The checking of the EQRTTS 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 HR9900A Include. It is this Include that uses the &HRSVER Macro variable. This Macro variable contains the owner code of the DB2 EQRTTS table to be used, e.g., BASE, INST, TEST or PROD).