The trick is to get the detail template right, the rest will usually follow. To do this, write out what you want your table to look like.
Do you want this?
z02 - x02 1st line - x02 second line
Then you've got the "missing detail" problem - there's an append (z03) for which there's no corresponding detail. Instead of the usual:
x01 1st line
x01 2nd line
x02 1st line
x02 second line
report layout, the appends are all together near the top, which suggest to me that you'll need to use two passes and an external lookup.
Before getting into that, could you confirm what you're looking for? Am I on the right lines?
Need to extract data from a file/report that has multiple lines per record.
it has headers z01,z02,z03 (only some of them)
it has multiple data records x01, x02 meaning file may have another two rows of x01,x02, up to 99
then it has a trailer record end01
i made the lines z01,z02,z03 as appendices adn extract multple data elements from each of these.
i made x01,x02 my data fields (two line trap) and it works pulling multiple occurrences of these fields back to the z01,z02,z03
then i have a trailer record which i also made an appendix and it populates on data lines fine.
the problem is z03 isn't on every "record". sometimes a record only has z01,z02. when it hits an occurrence of this, z03 of the previous record populates on the next record which it should just be blank as there was no z03 line in that record.
now.. each data record looks like this:
z01 with data elements (APPENDIX 1)
z02 with data elements (appendix 2)
z03 (only sometimes) with data elements (appendix 3)
x01 and x02 (always in record) (DETAIL)
x01 and x02 (different data but linked to same z01,z02, z03 record) (DETAIL)
and so on (Detail)
End01 with data elements. (Appendix 3)