MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Match and Eliminate records from files having Duplicates

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Bee_bop
Beginner


Joined: 12 Dec 2005
Posts: 29
Topics: 15
Location: Singapore

PostPosted: Wed Jan 20, 2010 10:58 pm    Post subject: Reply with quote

Hi Gurus,

What if the requirement is to compare both files and create an output that exist only in the first file and duplicates are included ?

File A:

AAAAAAA
BBBBBBB
BBBBBBB
BBBBBBB
CCCCCC
DDDDDD

File B:

AAAAAAA
CCCCCC

Output is :

BBBBBBB
BBBBBBB
BBBBBBB
DDDDDD

Thanks in advance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jan 21, 2010 12:09 pm    Post subject: Reply with quote

Bee_bop,

I assumed that both files are FB files with lrecl of 80. The following DFSORT JCL will give you the desired results. Concatenate a line HDR record before each file which we will use as indicator and using WHEN=GROUP we eliminate the matching records.

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
HDR                                                                 
//         DD *                                                     
AAAAAAA                                                             
CCCCCC                                                             
//         DD *                                                     
HDR                                                                 
//         DD *                                                     
AAAAAAA                                                             
BBBBBBB                                                             
BBBBBBB                                                             
BBBBBBB                                                             
CCCCCC                                                             
DDDDDD                                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(81:ID=1))
  SORT FIELDS=(1,7,CH,A),EQUALS                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(83:SEQNUM,8,ZD,RESTART=(1,7))),
  IFTHEN=(WHEN=GROUP,BEGIN=(83,8,ZD,EQ,1),PUSH=(82:81,1))           
  OUTFIL INCLUDE=(81,2,ZD,EQ,22),BUILD=(1,80)                       
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ping
Beginner


Joined: 16 May 2006
Posts: 1
Topics: 0

PostPosted: Mon Jan 25, 2010 7:54 am    Post subject: Reply with quote

Hi,
and with the new DFSORT function :

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTJNF1 DD *                   
AAAAAAA                           
CCCCCCC                           
//SORTJNF2 DD *                   
AAAAAAA                           
BBBBBBB                           
BBBBBBB                           
BBBBBBB                           
CCCCCCC                           
DDDDDDD                           
//SORTOUT  DD SYSOUT=*             
//SYSIN    DD *                   
  JOINKEYS FILE=F1,FIELDS=(1,7,A) 
  JOINKEYS FILE=F2,FIELDS=(1,7,A) 
  JOIN UNPAIRED,F2,ONLY           
  SORT FIELDS=COPY                 
//*                               
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group