MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Want to add a sequence number for duplicate records...

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Thu Jun 30, 2005 4:52 am    Post subject: Want to add a sequence number for duplicate records... Reply with quote

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
View user's profile Send private message
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Thu Jun 30, 2005 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jun 30, 2005 5:08 am    Post subject: Reply with quote

sree_sen,


Check this link

http://mvsforums.com/helpboards/viewtopic.php?t=2628&highlight=break

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jun 30, 2005 10:54 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
sree_sen
Beginner


Joined: 24 Jun 2005
Posts: 10
Topics: 3

PostPosted: Tue Jul 05, 2005 4:25 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jul 05, 2005 6:06 am    Post subject: Reply with quote

Sree_sen,

Check this link which discusses exactly a similar issue

http://mvsforums.com/helpboards/viewtopic.php?t=3716&highlight=original

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group