After comparasion of two sequential files for updating a change indicator field in the outputfile , i am using the following ICETOOL code, it's working fine.But this code seems to be lengthy ,can any body suggest how to minimise this code to minimise the response time.
SAME RECORD IS PRESENT IN TWO FILES SHOULD BE ELIMINATED.
BASED ON KEY FIELDS CHANGE INDICATOR WILL BE UPDATED AS ADDED,DELETED AND UPDATED.
This can be done by splicing function
Example given below:
Below is an ICETOOL job that can do this match by using the SPLICE operator. SPLICE helps you perform various file join and match operations. The trick here is to add an identifier of '11' to the File1 records, add an identifier of '22' to the File2 records, and splice the second id byte for matching records so we get '12' for names in both files, '11' for names only in File1 and '22' for names only in File2.
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input File1
//IN2 DD DSN=... input File2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5))
// USE MOD FOR T1
//OUT12 DD SYSOUT= names in File1 and File2
//OUT1 DD SYSOUT= names in File1 only
//OUT2 DD SYSOUT= names in File2 only
* Add '11' identifier for FILE1 records.
COPY FROM(IN1) TO(T1) USING(CTL1)
*Add '22' identifier for FILE2 records.
COPY FROM(IN2) TO(T1) USING(CTL2)
*SPLICE to match up records and write them to their appropriate output files.
SPLICE FROM(T1) TO(OUT12) ON(1,1,CH) WITH(13,1) -
//CTL1CNTL DD *
Mark FILE1 records with '11'
//CTL2CNTL DD *
Mark FILE2 records with '22'
//CTL3CNTL DD *
* Write matching records to OUT12 file. Remove id.
* Write FILE1 only records to OUT1 file. Remove id.
* Write FILE2 only records to OUT2 file. Remove id.
So when the records are present in both the files it has '12' you put 'U' as indicator,
Present only in first '11' if this is for add 'A' and present only in secord is '22' id it is for deletion put 'D'.
When we do the overlay on the second digit of the combination '11' and '22'.
so if record is present in both the files it will have '12' in the record and if only in first file then '11' will remain and if only in second then '22' will remain.
I hope you got the Idea of this.
If you want to see how this is done go and change the temporary file to some output file and see the result.
That is the best way to do this.