I have the below requirement but am not able to decide on the approach to take:
I need to write data to a fixed format out put file where each record spans over multiple lines as seen below:
000120992599999990000000000000009291100000000000000000000000010000
000000000000000000000006050052570009700000050000990494920000111100
ABCDE:WXYZ 0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
000000000000000000000006050052730005700001100000090494920000221200
ABCDE:WXYZ 0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
000000000000000000000006050113110009700000000000000494920000311100
ABCDE:WXYZ 0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
000012099259999999000000000000000929110000000000000000000000001000
This is one record from above example:
000000000000000000000006050052570009700000050000990494920000111100
ABCDE:WXYZ 0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
descriptiongoesheredescriptiongoesheredescriptiongoesher0200
The first and last line are header and footer respectively. First line of each record contains several details. 2nd line have some other details with spaces.
I have a long description field which I need to divide into 56 characters sections and append those with record's 3rd line onwards.
So in some of the records, this may be just one line while in some it could be three lines as well.
I need guidance about how to design my itemwriter in above scenario.
Nik