View previous topic :: View next topic
|
Author |
Message |
zaphany
New User
Joined: 16 May 2006 Posts: 11
|
|
|
|
Dear all, I am new to icetools and struggling with the sort of the following, please help!
File 1 :
field1 pic9(9)
field2 pic9(8)
12345678933333333
12345678988888888
12345678999999999
23456788811111111
34567890133464646
File 2 :
field1 pic9(9)
field2 pic9(10)
0101010101313131313
1234567891313131311
1234567893313113131
3456789011213311111
Expected result
Try to merge File1 & File 2 based on File 1 if field1 matches
123456789333333331313131311
123456789333333333313113131
123456789888888881313131311
123456789888888883313113131
123456789999999991313131311
123456789999999993313113131
345678901334646461213311111
Thanks in advance |
|
Back to top |
|
|
rajandhla
Active User
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
Back to top |
|
|
zaphany
New User
Joined: 16 May 2006 Posts: 11
|
|
|
|
Thanks Jai, i did read this example and tried, but the case I am facing is that field1 in both files can appear more than once and I am trying to get all the combinations...
please help...
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
zaphany,
You're trying to do a cartesian join. SPLICE can't do that. |
|
Back to top |
|
|
zaphany
New User
Joined: 16 May 2006 Posts: 11
|
|
|
|
Thanks Frank! looks like i need to write programs for that... |
|
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=*
//FILE1 DD *
12345678933333333
12345678988888888
12345678999999999
23456788811111111
34567890133464646
//FILE2 DD *
cccccccccdddddddddd
0101010101313131313
1234567891313131311
1234567893313113131
3456789011213311111
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=FILE1,FIELDS=(1,9,A),SORTED
JOINKEYS F2=FILE2,FIELDS=(1,9,A),SORTED
REFORMAT FIELDS=(F1:1,17,F2:13,10)
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 |
|
|
|