compare 2 sorted files



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

compare 2 sorted files

Postby charavind17 » Tue Mar 18, 2008 1:42 pm

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
charavind17
 
Posts: 4
Joined: Tue Mar 18, 2008 1:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: compare 2 sorted files

Postby charavind17 » Tue Mar 18, 2008 5:30 pm

//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
//*
charavind17
 
Posts: 4
Joined: Tue Mar 18, 2008 1:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: compare 2 sorted files

Postby charavind17 » Tue Mar 18, 2008 5:32 pm

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
charavind17
 
Posts: 4
Joined: Tue Mar 18, 2008 1:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: compare 2 sorted files

Postby charavind17 » Tue Mar 18, 2008 5:32 pm

see top one
charavind17
 
Posts: 4
Joined: Tue Mar 18, 2008 1:17 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post