Are these standard HL7 batch headers and footers (BHS/BTS, FHS/FTS, etc) or something custom to your organization?
If they are one of the HL7 standards, have a look at these docs on HL7 batches:
One tricky part will be triggering when an old batch ends/new batch begins -- this will depend on your local requirements.
If they are custom, there are a few approaches you can consider:
- You could use the Record Mapper to define a record map class with header/footer and a single field record for the HL7 content. You would then use one of the EnsLib.RecordMap.Operation.* classes instead of EnsLib.HL7.Operation.FileOperation:
In particular, have a look at RolloverSchedule and/or RolloverLimit to control when a new batch file is created.
- If you're comfortable creating a custom class that extends EnsLib.HL7.Operation.FileOperation, you could override the outputDocument method. In your custom version of outputDocument you could check if the file already exists using ##class(%File).Exists(pathToFile) and if it doesn't you would write out the footer to the previous file and the header to the new file before calling the standard version of outputDocument using ##super.