View previous topic :: View next topic
|
Author |
Message |
purushottam
New User
Joined: 26 Feb 2007 Posts: 37 Location: pune
|
|
|
|
Hi,
I have an input file with LRECL 38 and the contents as below:
Input:
0101491706051105OTE0000000000000000100
0101491706051105OTE0000000000000000200
0101491706051105OTE0001020000000000300
0101491706051105OTE0000000000000000400
Key is from position (1,13)
It is a Fixed Block file. I need the output as displayed below. I tried to used the SPLICE for the same but since my input can have variable number of key occurances (from 1-20)
Output:
0101491706051105OTE00000000000000001000101491706051105OTE00000000000000002000101491706051105OTE00010200000000003000101491706051105OTE0000000000000000400 |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
So you need the data in LRECL of 152 for every four records?
Which version of DFSORT are you using? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And is the output to be fixed-length, or variable? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
purushottam,
Look up SPLICE with INREC IFTHEN and code it for your max occurrence which in your case is 20. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Kolusu,
Why RESIZE is not a better option this case? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Pandora-Box wrote: |
Kolusu,
Why RESIZE is not a better option this case? |
You need to read the requirement once again.
purushottam wrote: |
Key is from position (1,13)
It is a Fixed Block file. I need the output as displayed below. I tried to used the SPLICE for the same but since my input can have variable number of key occurances (from 1-20) |
OP has a multiple keys in his file and for each key can be variable with max of 20 records per key.
ex:
Code: |
----+----1----+----2----+----
KEY01 DATA RECORD-01
KEY01 DATA RECORD-02
KEY01 DATA RECORD-03
KEY01 DATA RECORD-04
KEY01 DATA RECORD-05
KEY02 DATA RECORD-AA
KEY02 DATA RECORD-BB
KEY03 DATA RECORD-CC
KEY03 DATA RECORD-DD
KEY03 DATA RECORD-EE |
OP wants to club 5 records of KEY01 as a single record, 2 records of Key02 as a single record and 3 records of Key03 as a single record. RESIZE works with fixed number of records for each key. So you need to use splice |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks for the insight Kolusu |
|
Back to top |
|
|
|