Page 1 of 1

compare 2 sorted files

PostPosted: Tue Mar 18, 2008 1:42 pm
by charavind17
I want to compare 2 sorted files on a particular field and write the matched records of the first file in the 3rd output file. how can I do it using jcl sort card and using join keys and reformat fields?
The sample files are
File A
123 rohan mumbai
234 sanu chennai
456 aaaa delhi

File B
123 d23 1234.60
345 d45 1456.90
456 d67 3456.00


output file
123 rohan mumbai
456 aaaa delhi

Re: compare 2 sorted files

PostPosted: Tue Mar 18, 2008 5:30 pm
by charavind17
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SAVEDD DD SYSOUT=*
//IN DD *
12345 RAM
12345 RAHUL
33333 SENTHIL
33333 SANTHOSH
33333 SARATH
78888 VENU
// DD *
12345 RAM
12345 RAMESH
21156 MAHESH
33333 SENTHIL
33333 SANTHOSH
33333 SENTHIL
78900 PRAKASH
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,5,CH) ON(7,8,CH) LASTDUP
//*

Re: compare 2 sorted files

PostPosted: Tue Mar 18, 2008 5:32 pm
by charavind17
charavind17 wrote:I want to compare 2 sorted files on a particular field and write the matched records of the first file in the 3rd output file. how can I do it using jcl sort card The sample files are
File A
123 rohan mumbai
234 sanu chennai
456 aaaa delhi

File B
123 d23 1234.60
345 d45 1456.90
456 d67 3456.00


output file
123 rohan mumbai
456 aaaa delhi

Re: compare 2 sorted files

PostPosted: Tue Mar 18, 2008 5:32 pm
by charavind17
see top one