View previous topic :: View next topic
|
Author |
Message |
Learncoholic
New User
Joined: 20 Sep 2007 Posts: 97 Location: India
|
|
|
|
Hi,
I have a file with layout as:
Code: |
AAA 123
BBB 345
CCC 4579
DDD 4578 |
I would like the O/P as:
Code: |
AAA 123 AAA(Repeated 5 times)
BBB 345 BBB(Repeated 5 times)
CCC 4579 CCC(Repeated 5 times)
DDD 4578 DDD9Repeated 5 times) |
Can you please suggest me?
Thanks |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
PARSE and BUILD |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
I know its not a good practice but an option if it is just limits to 5.
Code: |
//STEP1 EXEC PGM=SORT
//INA DD *
AAA 123
BBB 345
CCC 4579
DDD 4578
//INB DD *
AAA 123
BBB 345
CCC 4579
DDD 4578
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,3,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(1,3,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,8,F1:4,1,F1:1,4,F1:1,4,F1:1,4,F1:1,4,F1:1,4) |
Output:
Code: |
********************************* TOP OF DATA **********************************
AAA 123 AAA AAA AAA AAA AAA
BBB 345 BBB BBB BBB BBB BBB
CCC 4579 CCC CCC CCC CCC CCC
DDD 4578 DDD DDD DDD DDD DDD
******************************** BOTTOM OF DATA ******************************** |
|
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
I do not understand what is so complex about the requirement. It seems that it can be achieved by only doing a build as simple as:
Code: |
BUILD=(1,9,1,4,1,4,1,4,1,4,1,4) |
Learncoholic, please explain more about the complexity of the task.
. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
Haha, RahulG31, you spotted rightly. I don't know, why I had to think too much on that. |
|
Back to top |
|
|
|
|