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

Match and Merge Two Files with both having duplicate records


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

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Wed Oct 17, 2007 7:22 am
Reply with quote

Hi,

I'm having 2 Files IN1 and IN2.
Both files has 2 keys on which match and merge needs to be done
For IN1 - Key Position K1 starts from 8 with length 7 and 2nd key K2 starts from 15 with length of 4.
For IN2 - 1st Key K1 starts from Position 1 with length of 7. 2nd Key K2 starts from 8th Position with length of 4.

Both IN1 and IN2 can have duplicates based on K1 and K2.
Need to keep all records of IN1

IN1 Records
000000100000010001ABC
000000100000010001DEF
000000100000020001ABC
000000100000030004ABC
000000100000040001ABC
000000100000050001ABC
000000100000050001EFG
000000100000050001HIJ

IN2 Records
00000010001X12
00000010001X22
00000030004XYZ
00000030004X1Z
00000050001RST
00000050001XYZ

Output should be
000000100000010001ABCX12
000000100000010001ABCX22
000000100000010001DEFX12
000000100000010001DEFX22
000000100000020001ABC
000000100000030004ABCXYZ
000000100000030004ABCX1Z
000000100000040001ABC
000000100000050001ABCRST
000000100000050001ABCXYZ
000000100000050001EFGRST
000000100000050001EFGXYZ
000000100000050001HIJRST
000000100000050001HIJXYZ

Need to know how do i create an SPLICE JCL for above case
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 17, 2007 10:20 am
Reply with quote

sarbamrit
The example that you have shown says its many to many matching and is not possible by DFSORT/ICETOOL.
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: Sat Nov 21, 2009 12:38 am
Reply with quote

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports JOINKEYS which can do many to many matching. Here's the DFSORT job for this example:

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=(8,7,A,15,4,A)
  JOINKEYS F2=IN2,FIELDS=(1,7,A,8,4,A)
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,21,F2:12,3)
  OPTION COPY
/*


For complete details on JOINKEYS and the other new functions available with the Nov, 2009 DFSORT PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
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 Duplicate transid's declared using CEDA CICS 3
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
Search our Forums:

Back to Top