如何理解EDI文件?

发布于 2024-08-05 16:58:46 字数 302 浏览 9 评论 0原文

我以前见过 XML,但从未见过像 EDI 这样的东西。

如何读取该文件并获取我需要的数据?我看到类似 ~、REF、N1、N2、N4 之类的东西,但不知道这些东西是什么意思。

我正在寻找示例和文档。 我在哪里可以找到它们?

阿斯洛 我发现 EDI 指南说它基于“ANSI ASC X12/ ver. 4010”。 我应该搜索表格 X12 吗?

请帮忙。

I've seen XML before, but I've never seen anything like EDI.

How do I read this file and get the data that I need? I see things like ~, REF, N1, N2, N4 but have no idea what any of this stuff means.

I am looking for Examples and Documentations.
Where can I find them?

Aslo
EDI guide i found says that it is based on " ANSI ASC X12/ ver. 4010".
Should I search form X12 ?

Kindly help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

人心善变 2024-08-12 16:58:46

其他几个答案都非常好。我会尝试补充一些他们没有提到的内容。

EDI 是一组标准,其中最常见的是:

  • ANSI X12(在美国流行)
  • EDIFACT(在欧洲流行)

听起来您正在查看 X12 版本 4010。这是使用最广泛的(无论如何,根据我的经验) ) 版本。有很多很多不同的版本。

文件,或者正确的“交换”,由段和元素(有时是子元素)组成。每个段以两个或三个字标识符开始(ISA、GS、ST、N1、REF)。

所有文档的结构都以信封开始和结束。包络通常由 ISA 段和 GS 段组成。每个文件可以有多个 GS 段,但每个文件只能有一个 ISA 段(注意应该,不是每个人都遵守规则)。

ISA 是一个特殊的部分。尽管所有其他段都是定界的,因此可以具有不同的长度,但 ISA 段具有固定宽度。这是因为它告诉您如何读取文件的其余部分。

从 ISA 段的最后三个字符开始。这些将告诉您元素分隔符、子元素分隔符和段分隔符。下面是 ISA 行的示例。

ISA:00: :00: :01:1515151515 :01:5151515151 :041201:1217:U:00403:000032123:0:P:*~

在这种情况下,“:”是元素分隔符,“*”是子元素分隔符,“~”段分隔符。如果您只是想查看一个文件并在每个段定界符 (~) 后添加换行符,那就容易多了。

ISA 还会告诉您文档的来源和收件人、版本(00403,也称为 4030)以及交换控制号(0000321233)。在这个阶段,其他的事情对你来说可能并不重要。

该文档来自发送者“01:1515151515”和接收者“01:5151515151”。那么“01:”是怎么回事?嗯,这就引入了 EDI 中的一个重要概念,即限定符。有几个元素具有限定符,它们告诉您下一个元素的数据类型。在本例中,01 应该是 Dunn and Bradstreet 号码。 ISA05 和 ISA07 元素的其他限定符包括代表电话号码的 12 和代表“用户定义”的 ZZ。您会在 EDI 细分市场中发现限定符的概念。一个不错的经验法则是,如果它是两个字符,那么它就是一个限定符。为了了解所有限定符的含义,您需要一份标准指南(来自 EDI 标准机构的硬拷贝或某些软件)。

下一行是 GS。这是一个功能组(一种在交换中将类似文档分组在一起的方法)。例如,您可以在 ISA 中拥有多个采购订单和多个功能确认。这些应放置在单独的功能组(GS 段)中。您可以通过查看第一个 GS01 元素来了解 GS 段中的文档类型。

GS:PO:9988776655:1122334455:20041201:1217:128:X:004030

除了文档类型之外,您还可以再次看到 from (9988776655) 和 to (1122334455)。这次他们使用不同的标识符,这是合法的,因为您可能代表其他人接收交换(例如,如果您是中间人)。您还可以再次看到版本号,这次带有尾随“0”(0004030)。使用有效数字逻辑去除前导零。为什么这里多了一个零,而 ISA 中却没有?我不知道。最后,这个 GS 段也有它自己的标识符 128。

这就是信封的开头。之后会出现一个以ST开头的文件循环。在这种情况下,它们都是 PO,具有代码 (850),因此该行将以 ST:850:blablabla

开头 信封内容以引用 GS 标识符 (128) 的 GE 段结尾,因此您知道哪个段正在关闭。然后是 IEA,它同样结束了 ISA。

通用时间:1:128~
IEA:1:000032123~

这是结构概述以及如何阅读它。要理解它,您需要一本参考书或软件来理解代码,需要大量的时间和大量的练习。祝你好运,如果您有更具体的问题,请再次发帖。

Several of these other answers are very good. I'll try to fill in some things they haven't mentioned.

EDI is a set of standards, the most common of which are:

  • ANSI X12 (popular in the states)
  • EDIFACT (popular in Europe)

Sounds like you're looking at X12 version 4010. That's the most widely used (in my experience, anyway) version. There are lots and lots of different versions.

The file, or properly "interchange," is made up of Segments and Elements (and sometimes subelements). Each segment begins with a two- or three-word identifier (ISA, GS, ST, N1, REF).

The structure for all documents begins and ends with an envelope. The envelope is usually made up of the ISA segment and the GS segments. There can be more than one GS segment per file, but there should only be one ISA segment per file (note the should, not everyone plays by the rules).

The ISA is a special segment. Whereas all the other segments are delimited, and therefore can be of varying lenghts, the ISA segment is of fixed width. This is because it tells you how to read the rest of the file.

Start with the last three characters of the ISA segment. Those will tell you the element delimiter, the sub-element delimiter, and the segment delimiter. Here's an example ISA line.

ISA:00: :00: :01:1515151515 :01:5151515151 :041201:1217:U:00403:000032123:0:P:*~

In this case, the ":" is the element delimiter, "*" is a subelement delimiter, and "~" the segment delimiter. It's much easier if you're just trying to look at a file to put linebreaks after each segment delimiter (~).

The ISA also tells you who the document is from and to, what the version is (00403, which is also known as 4030), and the interchange control number (0000321233). The other stuff is probably not important to you at this stage.

This document is from sender "01:1515151515" and to receiver "01:5151515151". So what's with the "01:"? Well, this introduces an important concept in EDI, the qualifier. Several elements have qualifiers, which tell you what type of data the next element is. In this case, the 01 is supposed to be a Dunn and Bradstreet number. Other qualifiers for the ISA05 and ISA07 elements are 12 for phone number, and ZZ for "user defined". You'll find the concept of qualifiers all over EDI segments. A decent rule of thumb is that if it's two characters, it's a qualifier. In order to know what all the qualifiers mean, you'll need a standards guide (either in hard copy from the EDI standards body, or in some software).

The next line is the GS. This is a functional group (a way to group like documents together within an interchange.) For instance, you can have several purchase orders, and several functional acknowledgements within an ISA. These should be placed in separate functional groups (GS segments). You can figure out what type of documents are in a GS segment by looking at the first GS01 element.

GS:PO:9988776655:1122334455:20041201:1217:128:X:004030

Besides the document type, you can see the from (9988776655) and to (1122334455) again. This time they're using different identifiers, which is legal, because you may be receiving an interchange on behalf of someone else (if you're an intermediary, for instance). You can also see the version number again, this time with the trailing "0" (0004030). Use significant digits logic to strip off the leading zeros. Why is there an extra zero here and not in the ISA? I don't know. Lastly this GS segment also has it's own identifier, 128.

That's it for the beginning of the envelope. After that there will be a loop of documents beginning with ST. In this case they'd all be POs, which have a code (850), so the line would start with ST:850:blablabla

The envelope stuff ends with a GE segment which references the GS identifier (128) so you know which segment is being closed. Then comes an IEA which similarly closes out the ISA.

GE:1:128~
IEA:1:000032123~

That's an overview of the structure and how to read it. To understand it you'll need a reference book or software so you understand the codes, lots and lots of time, and lots and lots of practice. Good luck, and post again if you have more specific questions.

最佳男配角 2024-08-12 16:58:46

哇,闪回。已经十六年多了……

原则上,每一行都是一个“段”,标识符是行的开头是一个段标识符。每个段都包含“元素”,这些“元素”本质上是位置字段。它们由“元素分隔符”分隔。

不同的段意味着不同的东西,可以表示循环结构、重复等。

您需要获取当前版本的标准进行基本解析,然后您需要数据字典来描述您正在处理的文档的内容,然后您可能需要行业简介、实施指南或类似内容来处理您环境中特定文档类型的约定。

例子?不是最新的,但我相信您可以使用您选择的搜索引擎找到一大堆。一旦完成了基本的段/元素解析,您就可以处理应用程序级别的数据,我不知道一个通​​用示例对您有多大帮助。

Wow, flashbacks. It's been over sixteen years ...

In principle, each line is a "segment", and the identifiers are the beginning of the line is a segment identifier. Each segment contains "elements" which are essentially positional fields. They are delimited by "element delimiters".

Different segments mean different things, and can indicate looping constructs, repeats, etc.

You need to get a current version of the standard for the basic parsing, and then you need the data dictionary to describe the content of the document you are dealing with, and then you might need an industry profile, implementation guide, or similar to deal with the conventions for the particular document type in your environment.

Examples? Not current, but I'm sure you could find a whole bunch using your search engine of choice. Once you get the basic segment/element parsing done, you're dealing with your application level data, and I don't know how much a general example will help you there.

沧桑㈠ 2024-08-12 16:58:46

EDI 是一种结构化文本文件的文件格式,被许多大型组织和公司用于标准数据库交换。它往往比 XML 短得多,而 XML 过去在数据包必须很小的情况下非常有用。许多组织仍在使用它,因为许多大型机系统使用 EDI 而不是 XML。

使用 EDI 消息,您要处理与特定格式匹配的文本消息。这与 XML 模式类似,但 EDI 并没有真正的标准化模式语言。 EDI 消息本身并不是真正人类可读的,而大多数规范并不是真正机器可读的。这基本上是 XML 的优点,其中 XML 及其模式都可以被人类和机器读取。

当您通过某些客户端软件(不是基于浏览器的)进行电子银行业务时,您的系统上可能已经有多个 EDI 文件。尽管许多银行也使用自己定制的基于文本的格式,但银行仍然更喜欢 EDI 而不是 XML 来发送交易数据。

要了解 EDI,您必须首先了解数据,以及您要遵循的 EDI 标准。

EDI is a file format for structured text files, used by lots of larger organisations and companies for standard database exchange. It tends to be much shorter than XML which used to be great when data packets had to be small. Many organisations still use it, since many mainframe systems use EDI instead of XML.

With EDI messages, you're dealing with text messages that match a specific format. This would be similar to an XML schema, but EDI doesn't really have a standardized schema language. EDI messages themselves aren't really human-readable while most specifications aren't really machine-readable. This is basically the advantage of XML, where both the XML and it's schema can be read by humans and machines.

Chances are that when you're doing electronic banking through some client-side software (not browser-based) then you might already have several EDI files on your system. Banks still prefer EDI over XML to send over transaction data, although many also use their own custom text-based formats.

To understand EDI, you'll have to understand the data first, plus the EDI standard that you want to follow.

和影子一齐双人舞 2024-08-12 16:58:46

假设数据流以“ISA”开头,则开头应有一个“~ST*”部分,后跟三个数字。如果您可以发布这三位数字,我也许可以为您提供更多信息。另外,了解这个行业也会有帮助。例如,医疗保健使用 270、271、276、277 和其他一些。

Assuming the data stream starts with “ISA”, towards the beginning there should be a section “~ST*” followed by three numeric digits. If you can post these three digits, I can probably provide you with more information. Also, knowing the industry would be helpful. For example, healthcare uses 270, 271, 276, 277 and a few others.

屋顶上的小猫咪 2024-08-12 16:58:46

EDI 文件是使用多个 EDI 标准之一构建的数据文件。 EDI 标准是管理 EDI 文件内容和格式的具体准则。 EDI 文件包含以纯文本格式存储的结构化数据,用于在多个组织之间传输业务数据。

制定这些 EDI 标准的主要原因是确保企业可以使用“通用语言”进行通信。

EDI 文件可以按各种标准保存。以下是常见的EDI文件格式,

cXML
xCBL
ebXML
CSV
ANSI X12
编辑部
EDIFICE(信息技术)
编辑运输(交通)
ETIS(电信)

不同类型的 EDI 文件格式
平面文件
变量文件
固定平面文件

这是一篇关于 EDI 文件及其结构的深入博客,并附有相关示例 - https://www.commport.com/2022/07/12/edi-file/

An EDI file is a data file structured using one of the several EDI standards. EDI standards are specific guidelines that govern the content and format of EDI files. EDI file contains structured data stored in a plain text format and is used for transferring business data between multiple organizations.

The primary reason for having these EDI standards is to ensure that businesses can communicate in a” universal language”.

EDI files can be saved by various standards. Here are the common EDI file formats,

cXML
xCBL
ebXML
CSV
ANSI X12
EDIFACT
EDIFICE (Information Technology)
EDITRANS (Transportation)
ETIS (Telecommunications)

Different types of EDI File formats
Flat file
Variable file
Fixed flat file

Here is a indepth blog about EDI file and its structure with relevant examples - https://www.commport.com/2022/07/12/edi-file/

ま柒月 2024-08-12 16:58:46

EDI 有很多集和版本。我发现可以回答我所有问题的最佳资源就在下面这个网站。

https://www.stedi.com/edi

您可以按设置/版本搜索任何内容。它还具有 EDI 检查器,如果您正在创建 EDI,它会向您显示 EDI 出了什么问题。祝您好运!

EDI has so many sets and versions. The best resource i have found to answer all my questions has been at this site below.

https://www.stedi.com/edi

You can search by set/version anything really. It also has an EDI inspector that will show you what is wrong with your EDI if you are creating it.Best of Luck !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文