Flat File Disassembler Output Types in BizTalk Server 2004

I have seen a lot of posts on various news groups over the past few months about the Flat File Dissembler and how it produces output.  I think it is rather confusing so I put together a sample that I hope will shed some light on the subject.



Download: Flat File Disassembler Output Sample
Watch the video: Flat File Disassemblier Output Options Video



The Flat File Disassembler is used to convert flat file documents (either positional, delimited, or a supported combination) into XML based on a defined schema.  The schema must import the Flat File Schema Extensions and have all the required delimiters and positions set, of course.  Flashback: This type of conversion was accomplished using envelops in BizTalk 2002.



The Flat File Disassembler can take in a large batch file and produce either one large XML output or single record Xml outputs.  This is the confusing part… The control of this is based on how the schema is defined and how the properties are set on the Flat File Disassembler inside the Receive Pipeline.



Producing One XML Output


In order to produce one output file, simply define a single schema with the required Header, Body (make sure this is set to 1 to many), and Trailer records.  Then, set the Document Schema property inside the Receive Pipeline Disassembler component to this schema.  Do not set anything for the Header or Trailer Schema.  This will produce one output based on the input file. 



In my sample, this is illustrated in schema AllAsOne.xsd and AllAsOneNoHeader.xsd.  The accompanying pipelines are recAllAsOne.btp and recAllAsOneNoHeader.btp.



Producing Single Message Output


In order to produce a single XML document per input record, the Header, Body, and Trailer records will need to be defined as separate schemas.  Then, each of these will need to set accordingly inside the Receive Pipeline Disassembler component. The base Body message should be set to the Document Schema property.  



In my sample, this is illustrated in schema AllAsOne.xsd and AllAsOneNoHeader.xsd.  The accompanying pipelines are recAllAsOne.btp and recAllAsOneNoHeader.btp.



Inside the sample, pay special attention to the Receive Pipelines.  Note the differences in the setting and the schema to return a single record verses one file.  The sample includes both a flat file with a Header and one with just Body records.  To run the sample, see the ReadMe.txt. I have included 4 Orchestrations to allow for easy Receive and Send Port creation.