View previous topic :: View next topic
|
Author |
Message |
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
There are two sequential files, having few records in common (exactly identical). The requirement is to
a) merge the two files into a new file,
b) keep only non-common records in the new file.
E.g. say FILE A has 50 records, FILE B has 100 records and 25 records are common. You need to create a new file, say FILE3, which should have the non-common 100 records (25 from FILE1 + 75 from FILE2).
What would you do this using SORT / ICETOOL?
Note:
1. The file structures are same.
2. You may use more than one sort steps to achieve it.
Can u suggest some logic. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
are there duplicate records in File A and File B ?
Gerry |
|
Back to top |
|
|
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
There are only 25 matching records in both files remainig are unique |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
Code: |
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=file1
// DD DSN=file2
//UNMATCH DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(UNMATCH) ON(1,80,CH) NODUPS
/* |
I've assumed the file is FB and LRECL is 80
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
scorp,
Gerry's solution will work for the situation you described. Just use the correct ON(p,m,f) operand (starting position, length and format) for the key you want to use to check for duplicates.
For more information on using DFSORT's ICETOOL for various matching operations, see the "Create files with matching and non-matching records" Smart DFSORT Trick at:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094 |
|
Back to top |
|
|
scorp_rahul23
New User
Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Thanks a lot Frank and Gerry for inputs |
|
Back to top |
|
|
|