View previous topic :: View next topic |
Author |
Message |
sree_sen Beginner
Joined: 24 Jun 2005 Posts: 10 Topics: 3
|
Posted: Thu Jun 30, 2005 4:52 am Post subject: Want to add a sequence number for duplicate records... |
|
|
Hi,
I have a requirement where the records in my input file are in the following format -
abcd xyz s
abcd ijk p
mnop lhg r
abcd xyz s
abcd xyz s
...so on
Now i want to add a sequence number to each and keep on increasing for the duplicate records only.The o/p file wud look like -
abcd xyz s 1
abcd ijk p 2
mnop lhg r 3
abcd xyz s 2
mnop lhg r 3
..so on
I have tried searching for similar kinds, but couldnt find any...
Please tell me about what condition do I need to add with DUPS..
Thanks, _________________ -Sree |
|
Back to top |
|
 |
sree_sen Beginner
Joined: 24 Jun 2005 Posts: 10 Topics: 3
|
Posted: Thu Jun 30, 2005 4:54 am Post subject: |
|
|
sorry, typo error, read the last record in my o/p file should come as
abcd xyz s 3
instead of
mnop lhg r 3
...sorry once again, as i was in a quckfix mode to solve my production issue... _________________ -Sree |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Thu Jun 30, 2005 10:54 am Post subject: |
|
|
You can use DFSORT's new RESTART=(p,m) parameter with SEQNUM to restart the sequence number at the starting value (1 by default) each time a key changes, as shown in the DFSORT job below. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's new RESTART and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For
complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
abcd xyz s
abcd ijk p
mnop lhg r
abcd xyz s
abcd xyz s
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,4,CH,A)
OUTREC OVERLAY=(12:SEQNUM,1,ZD,RESTART=(1,4))
/*
|
SORTOUT would have:
Code: |
abcd xyz s 1
abcd ijk p 2
abcd xyz s 3
abcd xyz s 4
mnop lhg r 1
|
If that's not what you want, then please show a better example of your input and output (your original input and output doesn't make much sense). _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
sree_sen Beginner
Joined: 24 Jun 2005 Posts: 10 Topics: 3
|
Posted: Tue Jul 05, 2005 4:25 am Post subject: |
|
|
Hi,
I checked in the link as given by Kolusu and there the snippet of Frank gives me the output as-
AAA 1
AAA 2
AAA 3
BBB 1
BBB 2
CCC 1
DDD 1
DDD 2
DDD 3
DDD 4
AAA 1
AAA 2
CCC 1
BBB 1
DDD 1
Considering my input as below -
AAA
AAA
AAA
BBB
BBB
CCC
DDD
DDD
DDD
DDD
AAA
AAA
CCC
BBB
DDD
what I want as output is as
AAA 1
AAA 2
AAA 3
BBB 1
BBB 2
CCC 1
DDD 1
DDD 2
DDD 3
DDD 4
AAA 4
AAA 5
CCC 2
BBB 3
DDD 5
i.e I can say in the end No of AAA record types is n1, no of BBB rec types is n2 and so on.
Thanks in Advance, _________________ -Sree |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|