View previous topic :: View next topic
|
Author |
Message |
rahulabvp
New User
Joined: 05 May 2010 Posts: 7 Location: Bloomington, IL, USA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
I beg to disagree ...
a group operation starting with AAA can create the proper group sequence number |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
|