• You can use multiple data flows to write to the same file if you uncheck the "Overwrite file" flag in the Flat File Destination component. So data flow 1 could write the header record, data flow 2 the detail records, data flow 3 the trailer record. That is generally how I construct these multiple record type files.

    You could probably use either the derived column or script components to construct the header/trailer data.