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

Identifying common records in two files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Musab Razeen Ahmed

New User


Joined: 24 Feb 2011
Posts: 16
Location: India

PostPosted: Thu Jun 02, 2011 5:46 pm
Reply with quote

Hi Guys. Suppose I have two files

File A
1
2
3
4

File B
2
3
4
5
6

How can i use DFSORT to identify the common records in these two ?

Could anyone help me on this issue?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jun 02, 2011 6:36 pm
Reply with quote

Is it a homework? Have you searched DFSORT part of the forum... ???
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Jun 02, 2011 7:18 pm
Reply with quote

You can use JOIN KEYS
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jun 02, 2011 11:00 pm
Reply with quote

Musab Razeen Ahmed,

You could use a DFSORT JOINKEYS job like this:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input fileA
//IN2 DD DSN=...  input fileB
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,1,A),SORTED
  JOINKEYS F2=IN2,FIELDS=(1,1,A),SORTED
  REFORMAT FIELDS=(F1:1,80)
  OPTION COPY
/*


Alternatively, assuming there are no duplicates within each file and they have the same RECFM and LRECL, you could use the SELECT operator of DFSORT's ICETOOL like this:

Code:

//S2    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//CON DD DSN=...  input fileA
//    DD DSN=...  input fileB
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(1,1,CH) FIRSTDUP
/*


In either case, the output file would have:

Code:






If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 Pulling a fixed number of records fro... DB2 2
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top