Welcome to MSDN Blogs Sign in | Join | Help

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>

Published Friday, May 07, 2004 10:25 AM by skaufman
Filed under:

Comments

# re: Early Termination with Position Flat Files

Friday, May 28, 2004 9:24 AM by Mark Scott
What if you have both data missing at the end of each record line, and missing record lines? Here's an example:

1A LastName FirstName AccountNum OptionalData.
1B AccountType Status OtherData Optional.
1C SomemoreData MoreOptionalData.
2A LastName FirstName AccountNum OptionalData.
2B AccountType Status OtherData Optional.
2C SomemoreData MoreOptionalData.

What if record line "C" is completely missing (because it's optional)... on top of the other optional data at the end of each record not being supplied (blank spaces) as it should be. Maybe the person sending in the data saw it as optional and just didn't put it in. The allow_early_termination="true" might fix that but then you get an error like this:

Unexpected data found while looking for:
'C' at offset 1

# re: Early Termination with Position Flat Files

Monday, June 07, 2004 7:48 AM by Cordula
Hi Mark,
there you have to add parser_optimization="complexity" lookahead_depth="0" at the same position where the allow_early_termination property was added.

By
Cordula

# re: Early Termination with Position Flat Files

Friday, July 23, 2004 2:08 PM by Martins
Hi ,

where can I find these tricks and not published annotation's like allow_early_termination="true" ?

Is there any help not shipped with bts2004 ?

thanks,
Martins

# Base Data Types and Restrictions in the Schema Editor

Thursday, November 04, 2004 11:21 AM by Stephen Kaufman's WebLog
Anonymous comments are disabled
 
Page view tracker