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
 
TO REMOVE DUPLICATES FROM DIFFERENT FILE AND NOT FROM SAME

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
vina2010

New User


Joined: 06 Sep 2010
Posts: 19
Location: Bangalore

PostPosted: Fri Mar 02, 2012 11:04 pm    Post subject: TO REMOVE DUPLICATES FROM DIFFERENT FILE AND NOT FROM SAME
Reply with quote

Hi

I have a requirement to remove duplicates from two different file if it has duplicates in two different files not in the same. If the duplicates are in the same file then the duplicates should not be removed.

For Example:

File 1 has

AAAAAAA,1234
ZZZZZZZ,3452

File 2 has

AAAAAAA,1234
BBBBBBB,2345
BBBBBBB,2345
CCCCCC,5678

File 3 should have

BBBBBBB,2345
BBBBBBB,2345
CCCCCC,5678
ZZZZZZZ,3452

(order is not important)

Can anyone please guide to acheive this via JCL sorts? I need to consider both the fields in the sort separated by comma.
Back to top
View user's profile Send private message

elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Fri Mar 02, 2012 11:57 pm    Post subject:
Reply with quote

This can be achieved using JOINKEYS.

Code:

//SYSIN    DD *                                         
  OPTION  COPY                                           
  JOINKEYS FILE=F1,FIELDS=(1,12,A)                       
  JOINKEYS FILE=F2,FIELDS=(1,12,A)                       
  JOIN UNPAIRED,F1,F2,ONLY                               
  REFORMAT FIELDS=(F1:1,12,F2:1,12)                     
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,24)),               
         IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(1:13,12)) 
  OUTFIL FNAMES=SORTOUT,REMOVECC,BUILD=(1,12)           
//*                                                     


Output

Code:

BBBBBBB,2345
BBBBBBB,2345
CCCCCCC,5678
ZZZZZZZ,3452
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Sat Mar 03, 2012 12:21 am    Post subject:
Reply with quote

Here are two more ways to do it with DFSORT's JOINKEYS (I assumed the input files have FB/80):

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,15,A)
  JOINKEYS F2=IN2,FIELDS=(1,15,A)
  JOIN UNPAIRED,F1,F2,ONLY
  REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
  OPTION COPY
  INREC IFTHEN=(WHEN=(161,1,CH,EQ,C'1'),BUILD=(1,80)),
        IFTHEN=(WHEN=NONE,BUILD=(81,80))
/*


Code:

//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,15,A)
  JOINKEYS F2=IN2,FIELDS=(1,15,A)
  JOIN UNPAIRED,F1,F2,ONLY
  OPTION COPY
  OUTFIL VTOF,BUILD=(5,80)
/*
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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

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