Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort - sequence number by key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ark1208

New User


Joined: 01 Aug 2014
Posts: 1
Location: Hyderabad

PostPosted: Fri Aug 01, 2014 4:13 pm    Post subject: Sort - sequence number by key
Reply with quote

Please do not tag onto a four year old topic. Start a new one.
This has been split away from the original topic


How do I get sequence numbers within a group key

Input:

aaaaaaa
bbbbbbb
bbbbbbb
cccccccc
ddddddd
ddddddd
ddddddd
ddddddd
eeeeeee
eeeeeee
eeeeeee

Output: (Seq no should start from '1' when key changes)

aaaaaaa 0001
bbbbbbb 0001
bbbbbbb 0002
cccccccc 0001
ddddddd 0001
ddddddd 0002
ddddddd 0003
ddddddd 0004
eeeeeee 0001
eeeeeee 0002
eeeeeee 0003
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 01, 2014 4:29 pm    Post subject:
Reply with quote

1) As stated above - start a new topic.

2) Please use the SEARCH facility as this has been covered many times in the past for differing reasons.

3) Learn to use the code tags
Code:
[code]Your stuff goes here[/code]
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Fri Aug 01, 2014 4:41 pm    Post subject: Reply to: Sort - sequence number by key
Reply with quote

You go to the manual. You look in the index. You follow the references. You look to see that what you find does what you want. You code it and test it.

You will find it also possible with WHEN=GROUP, but since you only want plain sequence numbers within a key, it will be more efficient the other way.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 210
Location: Chennai

PostPosted: Fri Aug 01, 2014 5:29 pm    Post subject:
Reply with quote

Try this untested.

Code:

OPTION COPY                                     
OUTREC FIELDS=(1,8,SEQNUM,4,ZD,RESTART=(1,7))   



Hope this helps..
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Fri Aug 01, 2014 6:41 pm    Post subject: Reply to: Sort - sequence number by key
Reply with quote

magesh23586,

That's roughly what I was getting at.

I am going to start a "Fields Box". This is like a "Swear Box". Every time someone uses INREC FIELDS, OUTREC FIELDS or OUTFIL OUTREC, they have to contribute a small amount of currency to the "Fields Box".

Also, clearer (to me) to use OVERLAY to append data to a record:

Code:
 OPTION COPY                                     
 INREC OVERLAY=(9:SEQNUM,4,ZD,RESTART=(1,7))
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us