View previous topic :: View next topic
|
Author |
Message |
Megalai
New User
Joined: 13 Jan 2006 Posts: 16
|
|
|
|
Hi Friends,
Please tell me the Solution for the below.
Input file1:
Cust id Address
1 A1
2 A1
3 A1
2 A2
Input file 2:
Custid Contact
1 C1
1 C2
1 C3
2 C1
2 C2
Output file should be like this:
Cust id Address Contact
1 A1 C1
1 A1 C2
1 A1 C3
2 A1 C1
2 A2 C1
2 A1 C2
2 A2 C2
3 A1
i.e) for the matching custid's the address & contact info should be written to the output file along with the cust id.
Thanks and Regards,
Megalai. |
|
Back to top |
|
|
Megalai
New User
Joined: 13 Jan 2006 Posts: 16
|
|
|
|
Hi Friends,
Please assume that the Record length is 80.
Thanks,
Megalai . |
|
Back to top |
|
|
fixdoubts
New User
Joined: 21 Oct 2005 Posts: 54
|
|
|
|
Hi,
This might help you
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEIN1 DD *
1 A1
2 A1
3 A1
2 A2
//FILEIN2 DD *
1 C1
1 C2
1 C3
2 C1
2 C2
//OUT DD SYSOUT=*
//T1 DD DSN=XT2.SMS.TEST.SORT3,DISP=MOD
//TOOLIN DD *
COPY FROM(FILEIN1) TO(T1) USING(CPY1)
COPY FROM(FILEIN2) TO(T1) USING(CPY2)
SPLICE FROM(T1) TO(OUT) ON(1,1,CH)-
WITHALL KEEPNODUPS WITH(06,02) USING(CPY3)
/*
//CPY1CNTL DD *
OUTREC FIELDS=(1:1,4,80:X)
/*
//CPY2CNTL DD *
OUTREC FIELDS=(1:1,1,6:3,2,80:X)
/*
//CPY3CNTL DD *
OUTREC FIELDS=(1:1,1,6:3,2,80:X)
/*
//CPY3CNTL DD *
OUTFIL FNAMES=OUT,OUTREC=(1,80)
/*
//
|
The out put will be like this
Code: |
1 A1 C1
1 A1 C2
1 A1 C3
2 A1
2 A1 C1
2 A1 C2
3 A1
|
Regards, |
|
Back to top |
|
|
Megalai
New User
Joined: 13 Jan 2006 Posts: 16
|
|
|
|
Hi Fixdoubts,
Thanks for ur Reply. But my Requirement is i have to get the matching records for each Cust id the address and Contact.
Thanks,
Megalai |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I think what you're trying to do is the equivalent of a cartesian join - the first 2 in file1 has to be joined with the first and second 2 in file2, and then the second 2 in file1 has to be joined with the first and second 2 in file2. DFSORT/ICETOOL cannot do that. |
|
Back to top |
|
|
Megalai
New User
Joined: 13 Jan 2006 Posts: 16
|
|
|
|
Hi Frank,
Thanks for ur Reply.
thanks and Regards,
Megalai. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), you can now do a Cartesian join with JOINKEYS. For your example, you could use a DFSORT job like this:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
1 A1
2 A1
3 A1
2 A2
//IN2 DD *
1 C1
1 C2
1 C3
2 C1
2 C2
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,1,A)
JOINKEYS F2=IN2,FIELDS=(1,1,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,31,F2:15,2)
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 |
|
|
|