View previous topic :: View next topic |
Author |
Message |
kirank Beginner
Joined: 21 Apr 2004 Posts: 61 Topics: 33 Location: hyderabad
|
Posted: Tue Apr 07, 2015 9:34 pm Post subject: Writing unique numbers for duplicate records thru syncsort |
|
|
Hi,
Could you please help me in the following query:
I've a file with 5 fields and they may contain duplicate records. I want to write unique numbers to those duplicate records thru syncsort.
for example:
Code: |
NAME AGE M/F AMOUNT ADDR
SIV 30 M 1000 XYZ
SIV 30 M 1000 XYZ
SAI 31 M 2000 ABC
SAI 31 M 2000 ABC |
Now i want to have unique numbers as below:
Code: |
NAME AGE M/F AMOUNT ADDR UNIQUE NUMBER
SIV 30 M 1000 XYZ 1
SIV 30 M 1000 XYZ 2
SAI 31 M 2000 ABC 1
SAI 31 M 2000 ABC 2
|
Could you please resond to this query at the earliest as this is an urgent requirement.
Thank you,
Regards,
Kirank |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Wed Apr 08, 2015 1:34 am Post subject: |
|
|
You'll need to look at the document of WHEN=GROUP, with PUSH and SEQ, which is a sequence number within the group.
Code: | INREC IFTHEN=(WHEN=GROUP,
KEYBEGIN=(startofkey,lengthofkey),
PUSH=(positionyouwantit:SEQ=1)) |
Something like that, as an outline. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Apr 08, 2015 11:08 am Post subject: Re: Writing unique numbers for duplicate records thru syncso |
|
|
kirank wrote: |
Could you please resond to this query at the earliest as this is an urgent requirement. |
Kirank,
Since you already got the answer, you need to consider the following in future.
You need to remember that people help on voluntary basis. So please be respectful to their timings instead of demanding the solution as it an "Urgent requirement " . The usage of "Urgent/Immediately" would actually put off many people who are willing to help. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
t-bonham@scc.net Supermod
Joined: 18 Oct 2012 Posts: 30 Topics: 0 Location: Minneapolis, MN
|
Posted: Wed Apr 08, 2015 12:18 pm Post subject: |
|
|
Do you really need the unique number restarting from 1 for each group?
If not, you could just insert a sequence number on each record, which will make them unique. And that will run faster, since Sort won't have to keep track of the groups. |
|
Back to top |
|
|
kirank Beginner
Joined: 21 Apr 2004 Posts: 61 Topics: 33 Location: hyderabad
|
Posted: Fri Apr 24, 2015 10:20 pm Post subject: |
|
|
Thank you so much for the solution. Kolusu I will keep in mind your suggestion |
|
Back to top |
|
|
|
|