Hi All,
I am working with datastage version 7.0. I am facing a problem to read data from fixed width files using sequential file stage.
I am giving you my input file as follows..
Col1 Col2 Col3
100 ABC 213
101 DEF 12345
102 GHI 432
Please notify that my first row terminates after 213. There is no spaces/blank values.
If I define Col3 as varchar(3) it will be giving giving error as follows...
GettingSrcFileFormat..Sequential_File_0.DSLink3: read_fixedwidth() - row 1, column Col3, column unexpectedly ended by EOR.
I tried by increasing the size but that wasn't working.
My expected result would be like as follows..
Col1 Col2 Col3 Col4
100 ABC 213 Null
101 DEF 123 45
102 GHI 432 Null
Anyone of you can help me to resolve this issue.
Thanks in advance.
Fixed width files
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 28
- Joined: Wed Jan 11, 2006 8:29 pm
- Location: Singapore
- Contact:
Fixed width files
Last edited by puli.reddy on Wed Jan 25, 2006 1:48 am, edited 1 time in total.
Thnaks and Regards,
AnjiReddy.
AnjiReddy.
Your file is not fixed-width format or in a different format than you think. In order for it to be fixed width it would need spaces (otherwise your line 1 and line 2 would have different lengths!). It has EOR (end-of-record) terminators and one was encountered while parsing your input data.
You need to use an editor to look at your actual data format and then change your PX job to make it reflect that format.
You need to use an editor to look at your actual data format and then change your PX job to make it reflect that format.
-
- Participant
- Posts: 28
- Joined: Wed Jan 11, 2006 8:29 pm
- Location: Singapore
- Contact:
Thnaks
Thnaks for your reply. I know its not fixed width, How can we overcome such issues by using data stage. Can you tell me in detailed manner.
Thnaks and Regards,
AnjiReddy.
AnjiReddy.
Re: Fixed width files
Puli.reddy,
in your first post you stated
The error message means that you have declared the line to be longer than it actually is - since an EOR was encountered. This error message also tells you what position in the line it was as (you didn't post that part), that will help you diagnose what declaration is wrong.
Using sequential files in PX can be a bit more work to set up and get running than with Server jobs, but it remains a relatively simple task.
in your first post you stated
and now you are stating that you know the file is not fixed width? If you declare your column definitions correctly and also specify the correct sequential file attributes (column separators, line terminators, etc.) you will read the file. I can't answer your question since you haven't really told us what your problem is!puli.reddy wrote:...I am facing a problem to read data from fixed width files...
The error message means that you have declared the line to be longer than it actually is - since an EOR was encountered. This error message also tells you what position in the line it was as (you didn't post that part), that will help you diagnose what declaration is wrong.
Using sequential files in PX can be a bit more work to set up and get running than with Server jobs, but it remains a relatively simple task.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you edit the table definition that you imported, you will find that the physical column width is stored as Display Width. Or you can use the Edit Row facility to specify the column widths explicitly.
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.
-
- Participant
- Posts: 28
- Joined: Wed Jan 11, 2006 8:29 pm
- Location: Singapore
- Contact:
Re: Fixed width files
Arnd, Only last column isn't fixed width remaining all are fixed only. I have a requirement to consider it as fixed width. It was solved by using excel workbook. I imported srcfile into excel and saved it as delimiter. Later I took source as csv and achieved what I require.
Thanks.
I would welcome another solution to resolve this by using datastage with out using excel.
Thanks.
I would welcome another solution to resolve this by using datastage with out using excel.
Thnaks and Regards,
AnjiReddy.
AnjiReddy.
If one column is not fixed width then the file cannot be fixed width. Your requirements to consider the sequential file as fixed width don't change that fact. If you saved the file from Excel then it is a variable length delimited file, and you should declare it as such in PX.
You need to know your original source declaration. If all columns are fixed width except the last one declare it that way. For example, col 1 is CHAR(3), col 2 is CHAR(3) and the last column is VARCHAR(10). PX will interpret the columns correctly. Are the columns delimited?
You need to know your original source declaration. If all columns are fixed width except the last one declare it that way. For example, col 1 is CHAR(3), col 2 is CHAR(3) and the last column is VARCHAR(10). PX will interpret the columns correctly. Are the columns delimited?