I have requirement where I have compare TWO files with first file of length 5551 and second of 9(which will have only the key record which will be compared with first file) .Then compare the key(of length 9) in first file in the position 422 and second file in position 1.
If key record matches in both files then include a comment 'Amendment' and if its a new record and doesn't match the key record then include a comment 'New' - This will be written to third file which will of length 5560 (Where last 9 places will be the 2 comments which I have mentioned in quotes above).
P.S : The third file contents is always a copy of FIRST file + comments in the last 9 position.
This I tried to do using COBOL program using SEARCH and two READ statements. Somehow all the time I am ending up in getting only NEW as comment in the output irrespective of the key match and un-match.
So started testing using ICETOOL and the used below common JCL, which is roaming around in forum for quite a long.But somehow it's becoming little hard to fit into my requirement.
//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
//OUT13 DD SYSOUT=* records in File1 and File2
//OUT1 DD SYSOUT=* records in File1 only
//OUT3 DD SYSOUT=* records in File2 only
//TOOLIN DD *
* 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(422,9,CH) WITH(1,9) -
//CTL1CNTL DD *
* Mark FILE1 records with '11'
//CTL2CNTL DD *
* Mark FILE2 records with '33'
//CTL3CNTL DD *
**** Write matching records to OUT13 file and removes id.
**** Write FILE1 only records to OUT1 file and removes id.
**** Write FILE2 only records to OUT3 file and removes id.
Could you please guide with the right JCL or valuable comments ??
I'm getting below error in sysout though the length of the file I've mentioned is right.Also,want to know if the above JCL is right for the requirement I've mentioned in my first post.
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 09:40 ON SUN FE
ICE405A 0 JOINKEYS STATEMENTS HAD MISMATCH IN NUMBER, LENGTH OR ORDER OF KEYS
ICE751I 0 C5-K51707 C6-K51707 C7-K51707 E7-K51707
ICE052I 3 END OF DFSORT
Alas!! The output doesn't giving the data I'm expecting.The first file is getting copied completely inopt output and for the matching keys,the key field is copied from (5552 to 5560) instead of 'Amendment' and 'New'.
P.S : I removed WHEN=OTHERS statement as I was getting errros and I feel this statement won't make any difference.
Please guide me meanwhile I'm trying with trial and error method by referring the DFSORT manual.