View previous topic :: View next topic
|
Author |
Message |
Suresh Shankarakrishnan
New User
Joined: 11 Jul 2008 Posts: 42 Location: USA
|
|
|
|
Was not able to find this one on the forum......
Requirement is to eliminate duplicates from an input file, and also store the duplicates in a different file.
1. Input file. LRECL = 528. Fixed block. LRECL = 27456.
Cols 1-15, 74-79 and 87-93 are the columns to be used to eliminate duplicates.
2. First Output file. LRECL = 528.Fixed block. LRECL = 27456
Order does not matter. File will have unique records.
When retaining the unique record, the first record amongst the duplicates can be retained, though it does not matter
3. Second Output file. LRECL = 528.Fixed block. LRECL = 27456
Order does not matter. File will have the duplicate records.
Example shown below-
1. Input file with following records- only data for the three columns shown below-
cols 1-15 cols 74-79 cols 87-93
111111111111111 aaaaaa uuuuuuu
111111111111111 aaaaaa uuuuuuu
111111111111111 aaaaaa uuuuuuu
222222222222222 aaaaaa uuuuuuu
333333333333333 aaaaaa uuuuuuu
111111111111111 bbbbbb sssssss
111111111111111 bbbbbb sssssss
444444444444444 bbbbbb ddddddd
--------------------------------------------------------------
2. First Output file with unique records will have following records-
111111111111111 aaaaaa uuuuuuu
222222222222222 aaaaaa uuuuuuu
333333333333333 aaaaaa uuuuuuu
111111111111111 bbbbbb sssssss
444444444444444 bbbbbb ddddddd
------------------------------------------------------------
3. Second Output file will show the duplicate records eliminated from the first Output file.
111111111111111 aaaaaa uuuuuuu
111111111111111 aaaaaa uuuuuuu
111111111111111 bbbbbb sssssss
So, number of records in input file = number of records in First Output file + number of records in Second Output file. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Suresh Shankarakrishnan,
The following DFSORT/ICETOOL JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=Your input file,DISP=SHR
//UNQ DD SYSOUT=*
//DUPS DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(UNQ) ON(1,15,CH) ON(74,6,CH) ON(87,7,CH) -
FIRST DISCARD(DUPS)
//* |
|
|
Back to top |
|
|
Suresh Shankarakrishnan
New User
Joined: 11 Jul 2008 Posts: 42 Location: USA
|
|
|
|
Thanks Skolusu, it works . |
|
Back to top |
|
|
|