IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Repeat Sequence Number Until change in the Key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rahulabvp

New User


Joined: 05 May 2010
Posts: 7
Location: Bloomington, IL, USA

PostPosted: Thu Mar 29, 2018 12:51 pm
Reply with quote

Hello,

Below is my requirement.

Input
Code:
AAA
AAB
AAC
AAD
AAA
AAB
AAC
AAD
AAA

Output
Code:
AAA001
AAB001
AAC001
AAD001
AAA002
AAB002
AAC002
AAD002
AAA003

How can i accomplish this?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Mar 29, 2018 3:30 pm
Reply with quote

rahulabvp wrote:

How can i accomplish this?
With a great deal of difficulty if you DO NOT bother to give us any details whatsoever
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Mar 29, 2018 7:41 pm
Reply with quote

I beg to disagree ...
a group operation starting with AAA can create the proper group sequence number
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Mar 29, 2018 11:00 pm
Reply with quote

For some reason my post has been deleted...

First of all
Code:
 INREC BUILD=(1,3,SEQNUM,4,ZD)
 SORT FIELDS=(1,3,CH,A),EQUALS
 END

And next
Code:
 INREC IFTHEN=(WHEN=GROUP,
               KEYBEGIN=(1,3),
               PUSH=(8:SEQ=3))
 SORT FIELDS=(4,4,CH,A),EQUALS
 OUTREC BUILD=(1,3,8,3)
 END

If needed can be combined into a single job step with SYNCTOOL/ICETOOL
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Mar 30, 2018 12:18 am
Reply with quote

Code:
//S1 EXEC PGM=SORT                                       
//SYSOUT DD SYSOUT=*                                     
//SORTOUT DD SYSOUT=*                                   
//SORTIN DD *                                           
AAA                                                     
AAB                                                     
AAC                                                     
AAD                                                     
AAA                                                     
AAB                                                     
AAC                                                     
AAD                                                     
AAA                                                     
//SYSIN DD *                                             
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'AAA'),     
       PUSH=(4:ID=3))                                   
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Mar 30, 2018 12:41 am
Reply with quote

Is this data the only possible input?
Code:
AAA                                                     
AAB                                                     
AAC                                                     
AAD                                                     
AAA                                                     
AAB                                                     
AAC                                                     
AAD                                                     
AAA     

What is the role of all Axx, except AAA?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Apr 03, 2018 1:41 pm
Reply with quote

I still believe that it would be better and polite of the OP to actually clarify EXACTLY what the rules are from input to output.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
Search our Forums:

Back to Top