I have a flat file that i need to parse. The flat file is a pipe i.e. “|” delimited file.
So i have set up the flat file schema accordingly to parse the file.
The problem is when the character that is used as the delimiter appears as part of the data , how to handle this.
Example:
The following is 2 records in a flat file
tom1|1254,Convent Rd1|Pittsburgh|PA
tom2|1255,Convent Rd2|Harrisburgh|PA
The above file is parsed correctly.
But what happens if the name in the above file had a pipe(which is the delimiter) i.e. had “tom|” instead of tom1 in which case the file would look as
tom||1254,Convent Rd1|Pittsburgh|PA
tom2|1255,Convent Rd2|Harrisburgh|PA
So how to handle the above file?
If you have this situation then the data goes into the undefData when you parse the flatfile (convertToValues)…since there are no enough field definitions in plac according to FFSchema incase of your example —tom||
Some how you should not get the pipe in the data,so talk to the source file appteam and discuss this limitation with them mutual agreement should solve your issue.
I agree with RMG, you need to agree with whoever creates your input file and non-allowed characters. In your case they can’t use your delimeter, because otherwise your process will get confused. You can try alternative characters, a fixed length file, or perhaps an XML type.