View previous topic :: View next topic |
Author |
Message |
Nork1 Beginner
Joined: 22 Jan 2004 Posts: 4 Topics: 2
|
Posted: Fri Jan 23, 2004 6:10 am Post subject: Remove duplicates but ignore specific columns |
|
|
Hi.
I've been trying unsuccessfully to come up with a method of comparing records in a file and removing any in which data matches on parts of those records.
REC1 AGBNC#GB01DAY A NCU1 003 PGBNCA0D N
REC2 AGBNC#GB01DAY A NCU1 007 PGBNCA1D N
REC3 BGBNC#GB01DAY A NCU2 003 BGBNCA0D N
REC4 BGBNC#GB01DAY A NCU2 007 BGBNCA1D N
REC5 BGBNC#GB01DAY A NCU2 009 BGBNCA3D N
In the example above I want to ignore characters in columns 1, 23 and 29 (bold characters).
Ignoring these columns, records 1 and 3 match and are counted as duplicates as are records 2 and 4. The only non-matching record is 5 which is to be written to an output file.
Unfortunately I'm only a beginner on ICETOOL and my attempts so far have proved unsuccessful. Your help will be greatly appreciated.
Thanks! |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Jan 23, 2004 6:56 am Post subject: |
|
|
Nork1,
The following JCL will give you the desired results. The postions you want to eliminate are 1, 20, 26 ( as shown by you in bold) . so you can specify the sort fields without them and get the desired results.
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AGBNC#GB01DAY A NCU1 003 PGBNCA0D N
AGBNC#GB01DAY A NCU1 007 PGBNCA1D N
BGBNC#GB01DAY A NCU2 003 BGBNCA0D N
BGBNC#GB01DAY A NCU2 007 BGBNCA1D N
BGBNC#GB01DAY A NCU2 009 BGBNCA3D N
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(2,18,CH) ON(21,5,CH) ON(27,10,CH) NODUPS
//OUT DD SYSOUT=*
//*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Nork1 Beginner
Joined: 22 Jan 2004 Posts: 4 Topics: 2
|
Posted: Fri Jan 23, 2004 7:13 am Post subject: |
|
|
Kolusu,
Thanks for the prompt response... much appreciated! |
|
Back to top |
|
 |
|
|