IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comparing two files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Fri Oct 29, 2010 1:13 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Oct 29, 2010 1:31 pm
Reply with quote

Option 3.14 from your ISPF primary menu
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Oct 29, 2010 1:53 pm
Reply with quote

Expat,

Will 3.14 do it? icon_rolleyes.gif
Back to top
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Fri Oct 29, 2010 1:58 pm
Reply with quote

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
View user's profile Send private message
steve6

New User


Joined: 10 Jul 2007
Posts: 7
Location: Chennai

PostPosted: Fri Oct 29, 2010 2:06 pm
Reply with quote

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
View user's profile Send private message
Michael Angelo Pagala

New User


Joined: 02 Mar 2007
Posts: 34
Location: somewhere in the middle

PostPosted: Fri Oct 29, 2010 2:13 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Oct 29, 2010 2:15 pm
Reply with quote

Arun Raj wrote:
Expat,
Will 3.14 do it? icon_rolleyes.gif

It was in fact 3.13, but I always have to go one better icon_lol.gif
Back to top
View user's profile Send private message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Mon Nov 01, 2010 1:15 pm
Reply with quote

Hi Michael,

Thanks for the jcl code.. thats exactly what i was looking for..

Thanks guys for the help..

Grazias,
cima
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top