View previous topic :: View next topic
|
Author |
Message |
Ganesh Kalam Warnings : 1 New User
Joined: 11 Aug 2005 Posts: 45 Location: India
|
|
|
|
Is there any way to eliminate duplicate records from a file with out sorting it.
SUM FIELDS=NONE will eliminate duplicates but we have to use it with SORT FIELDS.
I want to keep the order of the records as is but want to eliminate duplicates.
If the input contains
3
5
4
3
5
4
the output should be
3
5
4
If any one has idea on how to do this...please help.. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi there,
U can acheiev in two steps.
1) In first step Specify
Code: |
INREC FIELDS=(1,80,SEQNUM,8,ZD)
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=NONE |
This will add sequence number after ur record & sort the field & remove duplicate.
2) In second step Specify
Code: |
SORT FIELDS=(80,8,CH,A)
OUTREC FIELDS=(1:1,80) |
This will keep the record in prev order( According to seqnumber)
Hope it will helpful. |
|
Back to top |
|
|
Gautam512
Active User
Joined: 05 Oct 2005 Posts: 308 Location: Vizag / US
|
|
|
|
thats a gud solution....
u can go wth it..... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You do need two passes, but you can do it in one DFSORT/ICETOOL step:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(1,1,CH) FIRST USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
SORT FIELDS=(81,8,ZD,A)
OUTREC BUILD=(1,80)
/*
|
|
|
Back to top |
|
|
Ganesh Kalam Warnings : 1 New User
Joined: 11 Aug 2005 Posts: 45 Location: India
|
|
|
|
Hi Guptae/Frank,
Both the solutions are working very fine.. Thanks for your help.. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Ganesh,
Glad i could help |
|
Back to top |
|
|
Alain Benveniste
New User
Joined: 14 Feb 2005 Posts: 88
|
|
|
|
Ganesh,
your input shows few different keys. If it is the reality and if you know them you could that i 1 pass.
Alain |
|
Back to top |
|
|
Ganesh Kalam Warnings : 1 New User
Joined: 11 Aug 2005 Posts: 45 Location: India
|
|
|
|
Hi Alain,
I dont know the key values. Just i gave the sample input to explain my problem.
If you have any solution other than that given by Guptae and Frank, please share with us.
Thanks for your help in advance. |
|
Back to top |
|
|
Alain Benveniste
New User
Joined: 14 Feb 2005 Posts: 88
|
|
|
|
Ganesh,
Code: |
I dont know the key values
|
I wanted you to clarify this point. But, I don't have anything else to add to the solutions given above.
Alain |
|
Back to top |
|
|
|