Sunday, January 23, 2011

Early Termination with Position Flat Files

When working with flat files, BizTalk assumes that each and every line contains data to match the length of the record you specified in your schema. If the data does not match the length with data then it expects that it will find spaces. It does not expect to find an early CR LF.

For example, I have a flat file with 23 characters per line and have specified that in my schema. The last line, however, only has 20 characters.


ROI1LOANLOANP088ISRTRFD

ROI1LOANLOANP088UPDTRFD

RZA1LOANLOANP076ISRT

(this line ends early and is not filled with spaces)

If the data does not extend out to the end then you will receive an error like the following: 'Unexpected data found while looking for: \r\n'


To make BizTalk recognize an early terminator you need to open your schema in a text editor and add allow_early_termination = "true" to the xs:annotation node. This property is not exposed in the BizTalk XSD editor.


This is a snippet of the schema up to the end of the annotation node.


<?xml version="1.0" encoding="utf-16"?>

<xs:schema xmlns="http://NPP.ML" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://NPP.ML" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:annotation>

<xs:appinfo>

<b:schemaInfo count_positions_by_byte="false" standard="Flat File" root_reference="ML_Multiple" allow_early_termination="true"/>

<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />

</xs:appinfo>

</xs:annotation>


No comments:

Post a Comment