View previous topic :: View next topic
|
Author |
Message |
Ashraya HG
New User
Joined: 16 Jun 2005 Posts: 2 Location: Bangalore
|
|
|
|
I want to split a large file based on Key into small file.
My Input file is where key position is 1-4 and each key can present (1-Many records)
----+----+----+----+--------+
0001 - { other data records }
0001 - { other data records }
0002 - { other data records }
0002 - { other data records }
0002 - { other data records }
0003 - { other data records }
0003 - { other data records }
0004 - { other data records }
0005 - { other data records }
0005 - { other data records }
0006 - { other data records }
....
9999 - { other data records }
I want the master input file to split into small output files based on key.
Example from Key "0001"' upto Key '"1000"' into FILE1 ;
0001 - { other data records }
....
1000 - { other data records }
then key "1001"to "2000" into FILE2
1001 - { other data records }
....
2000 - { other data records }
then key "2001"to "3000" into FILE3
2001 - { other data records }
....
3000 - { other data records }
so on so forth till FILE9 |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1350 Location: Bamberg, Germany
|
|
|
|
SPLITBY* might not match the requirement when you have duplicate keys within a range. OUTFIL with INCLUDE from and to range is more apropriate for this task. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
|
|
I agree . Thanks
Code: |
OPTION COPY
OUTFIL FNAMES=F1000,
INCLUDE=(1,4,ZD,GE,0001,AND,1,4,ZD,LE,1000)
OUTFIL FNAMES=F2000,
INCLUDE=(1,4,ZD,GE,1001,AND,1,4,ZD,LE,2000)
… |
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2157 Location: USA
|
|
|
|
Ashraya HG wrote: |
I want to split a large file based on Key into small file.
My Input file is where key position is 1-4 and each key can present (1-Many records)
Code: |
----+----+----+----+--------+
0001 - { other data records }
0001 - { other data records }
0002 - { other data records }
0002 - { other data records }
0002 - { other data records }
0003 - { other data records }
0003 - { other data records }
0004 - { other data records }
0005 - { other data records }
0005 - { other data records }
0006 - { other data records }
....
9999 - { other data records } |
I want the master input file to split into small output files based on key.
Example from Key "0001"' upto Key '"1000"' into FILE1 ;
Code: |
0001 - { other data records }
....
1000 - { other data records }
then key "1001"to "2000" into FILE2
1001 - { other data records }
....
2000 - { other data records } |
then key "2001"to "3000" into FILE3
Code: |
2001 - { other data records }
....
3000 - { other data records }
so on so forth till FILE9 |
|
Please find all required answers here |
|
Back to top |
|
|
|