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

How to know missing records between 2 files (Set and Sub-set


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Tue Feb 15, 2011 10:39 am
Reply with quote

Hi,

Could you please help me out?
Below is the my requirement

File-1 is set and file-2 sub set(all records of file-2 will present in file-1, but vise-versa is NOT true)

Now I want to know which all records are missing in file-2, when compare to file-1.

File-1
Code:
01
02
03
04
05
06

File-2
Code:
01
03
05

Expected out of file-3
File-3
Code:
02
04
06

NOTE: content of all files is in BINARY format

Rgds,
Srini
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Tue Feb 15, 2011 12:25 pm
Reply with quote

Hi vicharapusrinu,
You can use the DFSORT job below.

Code:

//S1 EXEC PGM=SORT                     
//SYSOUT DD SYSOUT=*                   
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file2                             
//SORTOUT DD DSN=...  output file                 
//SYSIN    DD  *                 
  JOINKEYS F1=IN1,FIELDS=(1,2,A)
  JOINKEYS F2=IN2,FIELDS=(1,2,A)
  JOIN UNPAIRED,F1,ONLY         
  REFORMAT FIELDS=(F1:1,2)       
  OPTION COPY                   
//*                             


Thanks,
Ashwin.
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: Wed Feb 16, 2011 12:24 am
Reply with quote

If the records in input file1 are already sorted (as shown in the example), it would be more efficient to add SORTED to the JOINKEYS statement for F1. If the records in input file2 are already sorted (as shown in the example), it would be more efficient to add SORTED to the JOINKEYS statement for F2.

Alternatively, assuming the two input files have the same RECFM and LRECL, you can use a DFSORT/ICETOOL job like the following:

Code:

//S1 EXEC PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                 
//DFSMSG DD SYSOUT=*                                 
//CON DD DSN=...  input file1
//    DD DSN=...  input file2                                           
//OUT DD DSN=...  output file                                     
//TOOLIN   DD  *                                     
SELECT FROM(CON) TO(OUT) ON(1,2,BI) NODUPS           
/*
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Feb 17, 2011 12:27 pm
Reply with quote

Dear Frank Yaeger/Lashwin.

I am glad to inform that it is working perfectly!!!!!!!!!!!!

Our forum help me so many times in order to know more about mainframe, I can't imagine my official life with out IBMMAINFRAMES.COM

Thanks, Thanks a lot Frank Yaeger and Lashwin.


Regards,
Srini.
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 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
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top