tags:

views:

785

answers:

4
+3  Q: 

EDI Format

I've read XML or CSV 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've seen somethings about x12 but don't know if thats what I have or not, how can I tell?

-- update

Thanks guys for the quick responses. Does anyone know of a parser that I can use in .Net? In the long run, I'm going to be converting this EDI file to a CSV file...

+6  A: 

EDI messages are defined by the X12 standard.

If you look for X12 parsers, you can find helpful information.

For example, http://code.activestate.com/recipes/299485/

S.Lott
+1. Definitely do NOT write your own X12 parser. Not that it's too difficult, just that it would be insane to recreate work that's been done and tested so many times before.
Joel Coehoorn
Not all EDI messages are X12 standard.
Gregory A Beamer
@Gregory A Beamer. What do you suggest the alternatives are?
S.Lott
+2  A: 

Those are ANSI X12 Files the standard is managed here http://www.wpc-edi.com/

Brief tutorial on structure

Hierarchy = Loops-> Segments -> Elements -> Sub Elements.

Loops are bounded either by control segments or logically based on the standard. Segments are separated by the segment terminator, by default ~ Elements are separated by the element separator, by default * Sub Elements are separated by sub element separator, by default :

cmsjr
+1  A: 

EDI is a delimited file format. You have to know both the line delimiter and the column delimiter (for lack of a better answer). You might, for example, see an EDI file with the following format (from http://www.slik.co.nz/HTML_help/edi_file_format.htm):

  HDR|6||||
  DTL|1|ABC|xyz|123|1
  DTL|13|ABC|animal|334|1
  DTL|11|ABC|sfdk|432|2
  DTL|12|ABC|wewdc|3|1
  DTL|14|ABC|qwdx|416|4

The first line is the header and tells you there are six records. The other lines are detail lines.

X12 is one standard used by EDI. You will see X12 used commonly in healthcare. If you have X12, you can examine the X12 standard to figure out how to parse.

Gregory A Beamer
+1  A: 

EDI stands for Electronic Data Interchange...

It's not a specific format per-se. Generally speaking it's a flat text file of data that usually has an associated published specification. For example: "Position 23-34 is the original price as a monetary value"

You really won't be able to do anything useful with an EDI file if you don't have the defined specification that goes along with it.

Once you get the specification, I believe how to read the file will be quite clear.

Generally the process is: 1. Read/Parse the EDI file. 2. Perform any processing/transformation on that data that you need to. 3. Persist it into your local system format (tables, other flat files, whatever).

Sorry there's not much more we could tell you unfortunately.

Macon Pegram