one file with multiple layouts
Moderators: chulett, rschirm, roy
one file with multiple layouts
I have one text file with 3 different layouts.
content of the file:
the first 5 lines contain header information (layout 1)
line 6 to 20 contains detail record information (layout 2)
line 21 to the end contain trailer information. (layout 3)
how can I read all three formats from the same sequential file?
I want to
read layout 1 and output to dataset 1,
read layout 2 and output to dataset 2,
read layout 3 and output to dataset3.
Can I do that in one job, and avoid all the warnings.
thanks in advance.
content of the file:
the first 5 lines contain header information (layout 1)
line 6 to 20 contains detail record information (layout 2)
line 21 to the end contain trailer information. (layout 3)
how can I read all three formats from the same sequential file?
I want to
read layout 1 and output to dataset 1,
read layout 2 and output to dataset 2,
read layout 3 and output to dataset3.
Can I do that in one job, and avoid all the warnings.
thanks in advance.
-
- Participant
- Posts: 12
- Joined: Wed Oct 03, 2007 9:11 am
- Location: London
Re: one file with multiple layouts
There are three different ways we approachAggie99 wrote:I have one text file with 3 different layouts.
content of the file:
the first 5 lines contain header information (layout 1)
line 6 to 20 contains detail record information (layout 2)
line 21 to the end contain trailer information. (layout 3)
how can I read all three formats from the same sequential file?
I want to
read layout 1 and output to dataset 1,
read layout 2 and output to dataset 2,
read layout 3 and output to dataset3.
Can I do that in one job, and avoid all the warnings.
thanks in advance.
1. Using Unix Command split the file into three different parts and load it using separate file stage
2. Load all the records as single row . In the next stage , based on the row count , split the row and assigned to the corresponding column
3. Using complex flat file stage
Regards
Raga
Raga
The CFF (Complex Flat File) stage uses data contents to determine record type, i.e. if the first byte contains one value it is record type 1, on another value it is record type 2, etc.
In this case it is line dependent, so I would read the data as one VarChar() column then use @INROWNUM in a transform stage to differentiate the 3 types of content.
In this case it is line dependent, so I would read the data as one VarChar() column then use @INROWNUM in a transform stage to differentiate the 3 types of content.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 63
- Joined: Mon Oct 20, 2008 12:01 am
- Location: Malaysia
-
- Premium Member
- Posts: 892
- Joined: Thu Oct 16, 2003 5:18 am