View previous topic :: View next topic |
Author |
Message |
ha.rajamohamed Beginner
Joined: 29 Jan 2006 Posts: 71 Topics: 22
|
Posted: Tue Feb 07, 2006 9:39 am Post subject: File Splitting |
|
|
Is there any way by which we can split the file in to no of file
For Example My file contains
AAAAAA
..
..
..
0000000
AAAAAA
..
..
..
0000000
AAAAAA
..
..
..
0000000
For me the above file should be splitted in to three file, If like the above n number of records are there it needs to split accordingly
with the below content in one file and so on....
AAAAAA
..
..
..
0000000 |
|
Back to top |
|
 |
moyeenkhan Beginner
Joined: 04 Dec 2002 Posts: 64 Topics: 21
|
Posted: Tue Feb 07, 2006 12:39 pm Post subject: |
|
|
Here is the Rexx logic that you can use
1. Allocate Input
2. Read Input
3. OutPut1='XXXXXXXX.XXXXXXX.'0001
4. Allocate Output1
5. Read Input Till End
If TheFirst6Bytes ='000000' Then Do
Add 1 to COunt
Close Output
Output='XXXXXXxx.XXXXXXX.'||Right(COunt,4)
Allocate Output
End
Write Output
6. CLose Input / Output |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Wed Feb 08, 2006 1:46 am Post subject: |
|
|
rajamohamed,
I believe you have a file with set of header-detail-trailer records. I assume that the records that start with AAAAAA are headers and that have '000000' are trailer records. You can use Sort to do the splitting efficiently, but it would be easy if you have any field in the header or trailer than can differenciate each header and trailer. I mean, instead of having just AAAAAA for header, if your dataset has AAAAAA1 for header 1, AAAAAA2 for header 2 and so on it would become very simple.
show us a sample of how your data is stored actually in your input file.
Thanks,
Phantom |
|
Back to top |
|
 |
ha.rajamohamed Beginner
Joined: 29 Jan 2006 Posts: 71 Topics: 22
|
Posted: Wed Feb 08, 2006 4:26 am Post subject: |
|
|
Phantom,
I can have 10 header records followed by detail record and its trailer recods respectively. Now I need to split all the 10 in to separate files.
Header (AAAAAAA -----followed by some details unique)
Detail Record1
Detail Record2
..
Detail Recordn
Trailer(000000000)
Header (AAAAAAA -----followed by some details unique)
Detail Record1
Detail Record2
..
Detail Recordn
Trailer(000000000)
This AAAAAAA for header and "000000000" for trailer are constants values to identify Header and Trailer records. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|