I'm experiencing a little issue and I'm asking for your help! Using BeanIO 2.1 and working on a fixed-length file, I'm currently trying to retrieve a record that is structured like this :28C:5n/5n
- ':28C:' : fix
- 5 numbers (maximum)
- '/' : fix
- 5 numbers (maximum)
Examples:
- :28C:61/00005
- :28C:100/00001
- :28C:12345/12345
Here is a snippet of the code:
<record name="statementNumber" class="com.batch.records.StatementNumber" occurs="1">
<field name="tag" type="string" length="5" rid="true" literal=":28C:" ignore="true" />
<field name="statementNr" type="int" length="unbounded" maxLength="5" />
<field name="separator" type="string" length="1" rid="true" literal="/" ignore="true" />
<field name="sequenceNr" type="int" length="unbounded" maxLength="5" />
</record>
When running my parser, I get this exception:
Cannot determine field position, field is preceded by another component with indeterminate occurrencesor unbounded length
My question is: how can I tell BeanIO that the field '/' is actually the delimiter between the two variable fields ?
Thanks in advance
You can only have 1 field of an unbounded length on a line. The BeanIO documentation says:
Honestly, I'm not sure if this can be done using BeanIO. Is it an option to read the
5n/5n
fields completely into Java as 1 field and splitting it on/
in your code, instead of BeanIO?