View previous topic :: View next topic
Author
Message
cima New User Joined: 22 Mar 2006Posts: 8
Hi,
I would like to compare 2 files, where I want to know which are present on both files or if only on one file, then it should indicate like in the output.
Example:
1st File:
ID01zzzzBBBBzzzzzzzzzzzzzzzzzzzzzzzzzzzz
ID02xxxxBBBBxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2nd File
ID01xxxxAAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ID01yyyyBBBByyyyyyyyyyyyyyyyyyyyyyyyyyyy
ID03xxxxBBBBxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OUTPUT:
MATCH ID01BBBB
FILE1 ID01AAAA
FILE1 ID02BBBB
FILE2 ID03BBBB
Hopefully its detailed enough..
Thanks,
cima
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Option 3.14 from your ISPF primary menu
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Expat,
Will 3.14 do it?
Back to top
Michael Angelo Pagala New User Joined: 02 Mar 2007Posts: 34 Location: somewhere in the middle
hi cima,
I am assuming you need only 1 output which list what is matched and not matched from the two files.
here is an untested code which I think can give the output you need.
Code:
//STEP1 EXEC PGM=SORT
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
ID01zzzzBBBBzzzzzzzzzzzzzzzzzzzzzzzzzzzz
ID02xxxxBBBBxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//SORTJNF2 DD *
ID01xxxxAAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ID01yyyyBBBByyyyyyyyyyyyyyyyyyyyyyyyyyyy
ID03xxxxBBBBxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,4,A,9,4,A),SORTED
JOINKEYS FILES=F2,FIELDS=(1,4,A,9,4,A),SORTED
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,4,9,4,F2:1,4,9,4)
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,8,CH,EQ,C' '),BUILD=(C'FILE2 ',9,8)),
IFTHEN=(WHEN=(9,8,CH,EQ,C' '),BUILD=(C'FILE1 ',1,8)),
IFTHEN=(WHEN=NONE,BUILD=(C'MATCH ',1,8))
/*
//*
Back to top
steve6 New User Joined: 10 Jul 2007Posts: 7 Location: Chennai
I guess expat wanted to suggest 3.13 here.
However, I am not sure if we can mention multiple column ranges in the 'CMPCOLN & CMPCOLO' of 3.13 option.
looking at the sample data I suppose the comparision should happen on 2 column ranges. 1-4 & 9-12.
So my suggestion would be to use the MATCH facility of Eztrieve (if Eztrieve can be considered as an option here).
If MATCHED....
If FILE1....
If FILE2...
would lead you to the desired output.
Back to top
Michael Angelo Pagala New User Joined: 02 Mar 2007Posts: 34 Location: somewhere in the middle
by the way..I apologize for my post above..I gave a solution wherein I didn't know if the TS is using syncsort
sorry guys
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Arun Raj wrote:
Expat,
Will 3.14 do it?
It was in fact 3.13, but I always have to go one better
Back to top
cima New User Joined: 22 Mar 2006Posts: 8
Hi Michael,
Thanks for the jcl code.. thats exactly what i was looking for..
Thanks guys for the help..
Grazias,
cima
Back to top
Please enable JavaScript!