[color=blue]
Hi,
I have fixed width flat file with only one column of size 618 char. I have no problems in reading the correct record, but there can be invalid records with either less or more than 618 char length. I want to identify these bad records and route them to a different file. Could you suggest me how I do this?
I defined a column with 1000 char as size, defined the delimiter '000' (which is equiavalent to no delimiter), but somehow its not working out.
[/color]
reading a fixed-width flat file
Moderators: chulett, rschirm, roy
Unless your fixed-width file has record delimiters (i.e. <cr><lf>) you cannot read it if some records have different lengths. So, does your file have line/record delimiters?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 247
- Joined: Thu Apr 27, 2006 6:38 am
- Location: Hyderabad
Since you have a terminator, what devidotcom suggested will work perfectly.
For the <lf> error - Have you declared the <cr><lf> in your sequential file stage definitions for the "record delimiter"?
For the <lf> error - Have you declared the <cr><lf> in your sequential file stage definitions for the "record delimiter"?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Look on the Stage properties of your Sequential File stage - is it set for UNIX-style, DOS-style or None? Look in the file itself, using a hex editor. How are lines in the file actually terminated?
Note that, if lines can be more, equal or less than 637 characters, then you do NOT have fixed-width format. Therefore you need to read using a single VarChar field, and test in a downstream Transformer stage whether the length is correct (and anything else you might want to test).
Server jobs do not support reject link on Sequential File stage; the advice from devidotcom relates only to parallel jobs.
Note that, if lines can be more, equal or less than 637 characters, then you do NOT have fixed-width format. Therefore you need to read using a single VarChar field, and test in a downstream Transformer stage whether the length is correct (and anything else you might want to test).
Server jobs do not support reject link on Sequential File stage; the advice from devidotcom relates only to parallel jobs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.