Positional Flat File Processing with BizTalk 2004: Early Termination

Here's a nice tip I found in the BizTalk newsgroup, which is a great resource for learning more about BizTalk. When you process positional flat files, BizTalk assumes that each line is completely filled with characters. For example you have two fields in your flat file: code (5 positions) and name (10 positions): BizTalk expects the file to look like this:

codeANameA12345<- end of line
codeBNameB     <- end of line

So even the name field of the second line only has 5 characters, the remaining 5 need to be filled with spaces. Suppose your file has the end of line directly after the contents of the name field ends:

codeANameA12345<- end of line
codeBNameB<- end of line

When you try to process this file, BizTalk will throw an exception: Unexpected data found while looking for:'\r\n'. David Downing (MSFT) has the solution: you can add the following annotation to the schemaInfo node:

allow_early_termination="true"

You'll have to edit the schema using a text editor because the BizTalk schema editor doesn't allow you to add this annotation. Now BizTalk will allow the last field to be early terminated. Christof Claessens suggests in a post that there are more of these undocumented hints, I'd love to see them published! :-)

1 Comment

Comments have been disabled for this content.