定义多记录格式,位置,平面文件模式。 [英] Defining multi-record format, positional, flat file schemas.

查看:59
本文介绍了定义多记录格式,位置,平面文件模式。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿帮派,

想知道是否有人可以帮助我。 我有一个多记录格式位置平面文件,我需要为其创建一个架构。 布局如下:

Wondering if someone could help me out.  I have a multi record format positional flat file i need to create a schema for.  THe layout would be the following:

Field1Field2Field3H01< crlf>

Field1Field2Field3H01<crlf>

Field4Field5Field6H02< crlf>

Field4Field5Field6H02<crlf>

Field7Field8D01< crlf>

Field7Field8D01<crlf>

我正在尝试使用平面文件架构向导但没有运气。

I am trying to use the Flat File Schema wizard but not having any luck.

有人可以帮忙吗?

谢谢,

Shane

推荐答案

我倾向于手工操作。 你的样本需要注意的重要事项是它不仅仅是一个位置,因为crlf意味着它也是分隔的 - 你需要混合。这是你文件的范围,你有重复的部分吗? 我认为
你需要一个类似于以下构建的模式:

I tend to just resort to doing it by hand.  The important thing to note with your sample is it's not just a positional, as the crlf mean it's also delimited - you need mix. Is that the extent of your file, do you have any repeating parts?  I think you'll want a schema that is built up similar to:

<Root>
  <Row>
    <Field1></Field1>
    <Field2></Field2>
    <Field3></Field3>
    <Other1></Other1>
  </Row>
  <Row>
    <Field4></Field4>
    <Field5></Field5>
    <Field6></Field6>
    <Other2></Other2>
  </Row>
  <Row>
    <Field7></Field7>
    <Field8></Field8>
    <Other3></Other3>
  </Row>
<Root>

如果字段是固定宽度,则可以使用重复元素。

If the Fields are fixed width, you could do that with a repeating element.

将您的Root设置为十六进制的后缀分隔符,用于
0x0d 0x0a
来处理crlf。 然后将每一行设置为位置。

Set your Root to have a postfix delimiter in hex for 0x0d 0x0a to handle the crlf.  Then set each Row to be positional.


这篇关于定义多记录格式,位置,平面文件模式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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