sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Wed Nov 10, 2010 2:23 pm Post subject: File Comparision with unequal no of records on two files |
|
|
Hi,
I need to compare two files file 1 with length as 80 and file 2 with length as 80.They key that can be used is 1,12 on both the files.File2 contains duplicates.
After the compare there is another comparision on file1 with file on 4 byte field.
The o/p file should contains the records satisfying the 1st compare and the 2nd compare as well.
Example:
File1:-(Not in sorted order)
123456789012 ABCD
234656789013 ABCD
123434569012 DEFG
File2:-
123456789012 GHID
123456789012 ABCD
234656789013 EFDG
234656789013 HIJK
O/P FILE:=
123456789012 ABCD
Please help me in writing a JCL using any utility.Thanks in advance |
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Nov 10, 2010 4:15 pm Post subject: |
|
|
sivafdms,
The following DFSORT JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
----+----1----+----2----+----3----+----4----+----5----+---
123456789012 ABCD
234656789013 ABCD
123434569012 DEFG
//INB DD *
123456789012 GHID
123456789012 ABCD
234656789013 EFDG
234656789013 HIJK
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,12,A,14,4,A)
JOINKEYS F2=INB,FIELDS=(1,12,A,14,4,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,80,?)
OUTFIL BUILD=(1,80),INCLUDE=(81,1,CH,EQ,C'B')
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|