Biztalk Debatch 平面文件,带有标题、2 个重复记录和带有标签标识符的预告片 [英] Biztalk Debatch flat file with header, 2 repeating records and trailer with tag identifiers

查看:19
本文介绍了Biztalk Debatch 平面文件,带有标题、2 个重复记录和带有标签标识符的预告片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有标头和尾标的平面文件,标签标识符分别为 APTHDR 和 APTDTL.

i have a flat file with header and trailers with Tag Identifiers as APTHDR and APTDTL respectively.

然而,当前文件让我感到恼火,因为它有重复记录问题.文件结构:

The current file has me miffed however, as it has a repeating record issue. File Structure:

    20data for the summary information 
        
     HE Header of record
        
     DE Detail of record
        
     HE Header of record
        
     DE Detail of record

     DE Detail of record
        
     20 trailler data

记录 20 = 一个实例用于摘要,一个实例用于预告片记录.

record 20 = one instance for summary, one instance for trailler record.

记录HE:一个HE有多个DE.一个文件有多个HE.

record HE: one HE have multiple DE. one file have multiple HE.

这是数据示例:

20201117125512HH  001APPOINTMENT DATA                                    85372
 HE0350100000001 1 2CROS04202020-11-25012020-11-25 15:30:00.000000        PIC077120                   128027  2020-11-17 12:50:52.000265 N  N   0000004390000000000186000000                              00000                              PIC077120           023095412
 DE035010000000C116780360635000000439PIC077120           023095412
 HE0350100000001 1 2CACG05002020-11-25012020-11-25 14:00:00.000000        3501382191/,                183699  2020-11-17 12:51:02.000864 N  Y NS0000013210083300043754000000                              00000                              3501382191/, 1621476023035082
 DE035010000000C3100203821910000010013501382191/, 1621476023035082
 DE035010000000C3100202566840000001003501382191/, 1621476023035082
 DE035010000000C3100203826550000001073501382191/, 1621476023035082
 DE035010000000C3100203852630000000203501382191/, 1621476023035082
 DE035010000000C3100203746790000000183501382191/, 1621476023035082
 DE035010000000C3100202903510000000753501382191/, 1621476023035082
 20201117125512TT  001000000000000000000110000000000

如果我使用单个集合,我会在正确的位置获得结果,但是一旦我尝试创建一个多记录文件,它就会被灌输.我只是不知道如何解决它.

I get the results in the correct placement if I use a single set, but once I try to create a multiple record file it get hosed. I just have no idea how to fix it.

谢谢!

推荐答案

首先你需要创建 3 个模式,一个 Header,一个 Body 和一个 Trailer.将您拥有的文件拆分为这些组件,以便您可以针对该部分测试每个模式,因为主体只有一个 HE 和多个 DE.

First of all you need to create 3 schemas, a Header, a Body and a Trailer. Split the file you have into those components so you can test each schema against that part, for the body just have the one HE and multiple DE.

然后您需要创建一个带有平面文件反汇编组件的管道,并在属性中设置所有三个架构.

Then you need to create a pipeline with a flat file disassemble component and set all three schema in the properties.

部署这些,创建一个使用管道的接收端口和位置,并订阅消息.

Deploy these, create a receive port and location that uses the pipeline, and have something subscribing to the messages.

示例架构

标题架构

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO68310662" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO68310662" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="Header" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" />
      <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>
  <xs:element name="Header">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="postfix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <b:groupInfo sequence_number="0" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element name="HeaderRecord">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="DateTime">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_length="14" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string" />
                </xs:simpleType>
              </xs:element>
              <xs:element name="Field" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_length="64" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

身体结构

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO68310662" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO68310662" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="Body" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" />
      <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>
  <xs:element name="Body">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="postfix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <b:groupInfo sequence_number="0" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element name="HeaderRecord">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name=" HE" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="Field1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_length="263" sequence_number="1" pos_offset="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" name="DetailRecord">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="2" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name=" DE" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="Field1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" pos_length="63" pos_offset="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

预告片架构

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO68310662" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO68310662" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="Header" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" />
      <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>
  <xs:element name="Header">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="postfix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <b:groupInfo sequence_number="0" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element name="TrailerRecord">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="DateTime">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_length="14" sequence_number="1" pos_offset="1" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string" />
                </xs:simpleType>
              </xs:element>
              <xs:element name="Field" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_length="37" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

输出消息 1

<Body xmlns="http://Scratch.SO68310662">
    <HeaderRecord xmlns="">
        <Field1>0350100000001 1 2CACG05002020-11-25012020-11-25 14:00:00.000000        3501382191/,                183699  2020-11-17 12:51:02.000864 N  Y NS0000013210083300043754000000                              00000                              3501382191/, 1621476023035082</Field1>
    </HeaderRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C3100203821910000010013501382191/, 1621476023035082</Field1>
    </DetailRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C3100202566840000001003501382191/, 1621476023035082</Field1>
    </DetailRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C3100203826550000001073501382191/, 1621476023035082</Field1>
    </DetailRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C3100203852630000000203501382191/, 1621476023035082</Field1>
    </DetailRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C3100203746790000000183501382191/, 1621476023035082</Field1>
    </DetailRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C3100202903510000000753501382191/, 1621476023035082</Field1>
    </DetailRecord>
</Body>

输出消息 2

<Body xmlns="http://Scratch.SO68310662">
    <HeaderRecord xmlns="">
        <Field1>0350100000001 1 2CROS04202020-11-25012020-11-25 15:30:00.000000        PIC077120                   128027  2020-11-17 12:50:52.000265 N  N   0000004390000000000186000000                              00000                              PIC077120           023095412</Field1>
    </HeaderRecord>
    <DetailRecord xmlns="">
        <Field1>035010000000C116780360635000000439PIC077120           023095412</Field1>
    </DetailRecord>
</Body>

这篇关于Biztalk Debatch 平面文件,带有标题、2 个重复记录和带有标签标识符的预告片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆