Apr 25th, 2008, 09:26 AM
Fixed Length file size
Is it possible to configure in the job file the line length of a flat file?
eg in the FixedLengthTokenizer:
<property name="names" value="ISIN, Quantity, Price, Customer" />
<property name="columns" value="1-12, 13-15, 16-20, 21-29" />
<property nalme="length" value="29" />
I'd like to fix the length line value in order to validate the file before parsing it.
Can someone have any idea about it?
Apr 25th, 2008, 09:49 AM
Just to clarify, do you mean the length of the line, (number of characters per line) or the length of the file (number of lines per file) ?
Apr 25th, 2008, 10:21 AM
I mean the length of the line (number of characters per line).
In my case, the flat file needs to have lines of 200 characters.
If one line doesn't check, the flat file has to be rejected.
Apr 25th, 2008, 11:07 AM
I may be misunderstanding, but doesn't the current implementation handle this? If the line size doesn't line up with the columns configured, it will throw a FlatFileParsingException, with the original line. Assuming you have configured your job to fail for this scenario, either by setting it as a failure causing exception if your'e using the SkipLimitFactoryBean, or by using a factory bean that doesn't allow skips.
May 23rd, 2008, 06:37 AM
I need to validate the length of the line before formatting it with FixedLengthTokenizer. For example, if the line is less than 100 chars I don't want to continue.
Or maybe someting like FixedLengthImportJobFunctionalTests....
May 23rd, 2008, 08:31 AM
Right, but if you configure the FixedLengthTokenizer with columns that add up to 100, and you give a line that is more or less than that, it should throw an exception.
May 23rd, 2008, 10:25 AM
No. It never throw an exception when the line is more or less.
I'm using the version 1.0.1.RELEASE. (Too I've checked with the trunk)