Import from fixed length file
Moderators: chulett, rschirm, roy
Import from fixed length file
Hi,
I have a fixed lenght file(without delimiter), I want to load it into a table/file after some transformation. Can anybody tel me if there is a way to import fixed lenght or should I convert the file manually to delimited one and use it. I checked it in sequential file stage, but it says it requires a delimiter
Regards,
Divya
I have a fixed lenght file(without delimiter), I want to load it into a table/file after some transformation. Can anybody tel me if there is a way to import fixed lenght or should I convert the file manually to delimited one and use it. I checked it in sequential file stage, but it says it requires a delimiter
Regards,
Divya
The sequential file stage can read and write fixed width files with or without delimiters. Just specify record length of "fixed" type file and delete the delimiter property.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Thanks ArndW!!
I tried the settings you proposed, but I get the following error when I try to view the data.
<Sequential_File_0> Unable to initialize the importer.
<Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "REC_TYPE".
"REC_TYPE" is my 1st field name.
Regards,
Divya
I tried the settings you proposed, but I get the following error when I try to view the data.
<Sequential_File_0> Unable to initialize the importer.
<Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "REC_TYPE".
"REC_TYPE" is my 1st field name.
Regards,
Divya
What data type is "REC_TYPE" - I would wager it is "VarChar" - which isn't a fixed length.
<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
I changed all fields to Char of specific length as per the file. But still I get the same error.
<Sequential_File_0> Unable to initialize the importer.
<Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "REC_TYPE".
Regards,
Divya
<Sequential_File_0> Unable to initialize the importer.
<Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "REC_TYPE".
Regards,
Divya
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It works!! Thanks all for your timely help!!!
Now I have another issue
I have a file containing different row types. Each row type has different number of columns of fixed length.
Eg:
Header
AAA field1(4) field2(11) field3(6) field4(7) field5(14)
BBB field1(9) field2(1) field3(16) field4(6) field5(4) field6(10) field7(11) field8(6) field9(2) field10(14)
CCC field1(7) field2(23)
-----------------
-------------
Footer
I need to import this entire file and filter each row type to specific destination.
I first imported the entire row as one single field and then used different transformers to send it to different targets. I used string functions in each transformer depending on the target to get that row type separately. But this becomes very complex when there are hundreds of fields in a row type.
Is there any better way to do this??
Regards,
Divya
Now I have another issue
I have a file containing different row types. Each row type has different number of columns of fixed length.
Eg:
Header
AAA field1(4) field2(11) field3(6) field4(7) field5(14)
BBB field1(9) field2(1) field3(16) field4(6) field5(4) field6(10) field7(11) field8(6) field9(2) field10(14)
CCC field1(7) field2(23)
-----------------
-------------
Footer
I need to import this entire file and filter each row type to specific destination.
I first imported the entire row as one single field and then used different transformers to send it to different targets. I used string functions in each transformer depending on the target to get that row type separately. But this becomes very complex when there are hundreds of fields in a row type.
Is there any better way to do this??
Regards,
Divya
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom