Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Comparing two files
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: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 29, 2010 1:31 pm    Post subject:
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: 2285
Location: @my desk

PostPosted: Fri Oct 29, 2010 1:53 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 29, 2010 2:15 pm    Post subject:
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    Post subject: Reply to: Comparing two files
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us