XML template for positional flat files

Hi all,

I need to create a flat file and defined a template to drive the data.
The record structure I created look like this:
rec0
rec1
rec2
rec4
rec9
The rec2 and rec4 are sub-records and are in the same ‘level’ inside rec1. The rec1 and rec4 are record lists.
The generated flat file look like this:
0datadatadata
1datadatadata
2datadatadata
4datadatadata
4datadatadata
.
.
4datadatadata
9datadatadata
The issue is that rec1 can have no data sometimes, and when it happens I append rec4 in an empty rec1, but when convert this record into flat file, the flat file shows up with a blank line right before the ‘4datadatadata’ line.
How should I define my template to skip the empty rec1 when it happens?

Thanks in advance,
Maldonado

Renato,

I could be wrong but I think you’re getting the correct behaviour from the template. The first record is either populated or its not. You might have to write some external service to strip off blank records.
If i’m off base hopefully someone else will chime in with the correct answer.

Good Luck!

Hi Chris,

Thanks for your feedback!
This was the workaround that I was thinking to do to solve it.
Since I’m a quite new on flat files, my hope was that there was a occurrence indicator, just like ‘,’ (comma) indicates repetition, that could help me indicating an optional segment. By the way, I tried ‘*’ (asterisk) and got the same result.

Thank you anyway