How to get out the Null row in a file
Moderators: chulett, rschirm, roy
How to get out the Null row in a file
Hi,
I've a problem. Our client has sometimes somes lines with nothing a in his file. For example :
Field1 ; Field2 ; Field3
Field1 ; Field2 ; Field3
(nothing)
Field1 ; Field2 ; Field3
And the output must be :
Field1 ; Field2 ; Field3
Field1 ; Field2 ; Field3
Field1 ; Field2 ; Field3
I dont't know if the following solution is the simplest solution :
1. In the columns description of the file, on Incompete columns, click on 'REPLACE' for all the fields
2. In a transformer, filter all row with Null key field
Thanks for all your ideas !
I've a problem. Our client has sometimes somes lines with nothing a in his file. For example :
Field1 ; Field2 ; Field3
Field1 ; Field2 ; Field3
(nothing)
Field1 ; Field2 ; Field3
And the output must be :
Field1 ; Field2 ; Field3
Field1 ; Field2 ; Field3
Field1 ; Field2 ; Field3
I dont't know if the following solution is the simplest solution :
1. In the columns description of the file, on Incompete columns, click on 'REPLACE' for all the fields
2. In a transformer, filter all row with Null key field
Thanks for all your ideas !
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Easier to process with a filter command in the Sequential File stage that reads the file. Use sed or awk or some other command that allows you to remove empty lines from a file.
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.
You can optionally read all the fields in a single field using Varchar datatype and eliminate the empty lines using transformer.
Optionally you can use FIND witn /V option to eliminate the empty lines. Iam just looking for the command to find the newline. If I get it, I ll update you.
Optionally you can use FIND witn /V option to eliminate the empty lines. Iam just looking for the command to find the newline. If I get it, I ll update you.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Shrek - you can get free UNIX utilities on Windows that include such tools as sed and awk; the most common one I know of is MKS toolkit, but MS also offers a package that will do this.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
When you say its nothing, you mean not even a delimiter? If thats the case then you can read the entire line as one record, do an INDEX() on delimiter and if its equal to 0 then reject it. You cannot exactly check for NULLS in a flat file.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Hi DSGuru2B,
Yes nothing, just the system character next line.
Often, this file CSV is generated from .XLS in which there is some empty rows. Sometimes times, there's only separators :
Field1 ; Field2 ; Field3
;;;;
;;
Field1 ; Field2 ; Field3
But, I can't ask the person generating this file to correct his CSV file (He doesn't know how to do...). And there'is some bug in generating CSV from XLS with empty last columns...
Yes nothing, just the system character next line.
Often, this file CSV is generated from .XLS in which there is some empty rows. Sometimes times, there's only separators :
Field1 ; Field2 ; Field3
;;;;
;;
Field1 ; Field2 ; Field3
But, I can't ask the person generating this file to correct his CSV file (He doesn't know how to do...). And there'is some bug in generating CSV from XLS with empty last columns...
Of course you can. Explain how. Anyone responsible for generating a spreadsheet as input to an automated process needs to be disciplined and not send you crap. They can delete the empty rows and/or columns before converting to csv format.shrek7577 wrote:But, I can't ask the person generating this file to correct his CSV file (He doesn't know how to do...).
There's no 'bug', it's all about the people working the spreadsheet.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers