Ask a questionAsk a question
 

AnswerHow to disable Flat File debatching?

  • Tuesday, November 03, 2009 11:09 PMKiryl Kavalenka Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I want my flat file schema to fail when the input file contains 2 or more concatenated messages. At the moment BizTalk parses the 1st message and ignores the rest.

    Here is my test message instance:
    D_TAGdata1
    D_TAGdata2
    T_TAGtrailer
    D_TAGdata3
    T_TAGtrailer

    Here is my schema:
    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://MFL.Schemas.Schemas.Test" targetNamespace="http://MFL.Schemas.Schemas.Test" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:annotation>
        <xs:appinfo>
          <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
          <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char="0x20" pad_char_type="hex" count_positions_by_byte="false" parser_optimization="complexity" lookahead_depth="0" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="true" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="Root" />
        </xs:appinfo>
      </xs:annotation>
      <xs:element name="Root">
        <xs:annotation>
          <xs:appinfo>
            <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
          </xs:appinfo>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:annotation>
              <xs:appinfo>
                <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
              </xs:appinfo>
            </xs:annotation>
            <xs:element maxOccurs="unbounded" name="Data_Record">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="positional" tag_name="D_TAG" tag_offset="0" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
                </xs:appinfo>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:annotation>
                    <xs:appinfo>
                      <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                  </xs:annotation>
                  <xs:element name="Tag" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" pos_offset="0" pos_length="5" sequence_number="1" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Field" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <fieldInfo sequence_number="2" justification="left" pos_offset="0" pos_length="5" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element minOccurs="0" name="Trailer_Record">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="positional" sequence_number="2" preserve_delimiter_for_empty_data="false" suppress_trailing_delimiters="true" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" tag_name="T_TAG" tag_offset="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:annotation>
                    <xs:appinfo>
                      <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                  </xs:annotation>
                  <xs:element name="Tag" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" pos_offset="0" pos_length="5" sequence_number="1" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Field" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" pos_offset="0" pos_length="7" sequence_number="2" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

Answers

  • Wednesday, November 04, 2009 3:33 AMGreg.ForsytheMVP, AnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You cannot disable debatching, this is automatic behaviour. I would suggest adding a document node to your schema:

    Root
       Document maxOccurs=unbounded
           DataRecord maxOccurs = unbounded
           Trailer

    This will parse the entire document, then implement a check to ensure the document count is 1.
    You can do this in a pipeline with a custom pipeline component or a map that throws an exception. Or in an orchestration.

All Replies

  • Wednesday, November 04, 2009 3:33 AMGreg.ForsytheMVP, AnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You cannot disable debatching, this is automatic behaviour. I would suggest adding a document node to your schema:

    Root
       Document maxOccurs=unbounded
           DataRecord maxOccurs = unbounded
           Trailer

    This will parse the entire document, then implement a check to ensure the document count is 1.
    You can do this in a pipeline with a custom pipeline component or a map that throws an exception. Or in an orchestration.
  • Wednesday, November 04, 2009 4:09 AMBiztalkGhost Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Let us know what is the concatenated message you are talking about to get a better picture.

    This may help you.

    Set Max Occurs = 1 in the schema
    Vijaykishan | http://v2attechhorizon.blogspot.com | Please mark this as answer if it helps