3

I'm looking for any helpful links or advice on translating an incoming EDI 940 (X12) to a (|) Pipe delimited flat file in c#.net

John Saunders
  • 160,644
  • 26
  • 247
  • 397
djshortbus
  • 359
  • 1
  • 4
  • 11

2 Answers2

2

My technique might seem quite heavy for a one shot translation, but here it is:

Step #1: X12 ------------- [Pre-Parsing Program] ---> X12 syntax XML

Step #2: X12 syntax XML--> [940 Parsing XSLT] ------> 940 XML

Step #3: 940 XML --------> [Mapping XSLT] ----------> your FF XML

Step #4: your FF XML ----> [Serialising XLST] ------> your FF

Step #1: The "X12 syntax XML" is a very simple grammar showing only the SYNTAX of X12, thus the [Pre-Parsing Program] is extremely simple, and can be used for any X12.

Step #2: The "940 XML" has a grammar which fully explicit the structure of the 940. The [940 Parsing XSLT] is where you express the specific structure of an 940.

Step #3: The [Mapping XSLT] transforms the 940 structure into the structure of your FF, expressed in XML.

Step #4: Finally, the [Serialising XLST] creates your FF based on its XML-ized version.

The main advantage of this architecture is its (1) openness - main parts are in XSLT that can be performed with any programming language using a variety of XML/XLST library, and its (2) scalability, at the end, you transform any format into any format ;-)

If you could upload somewhere a simple sample instance of a 940 message AND its translation into your FF structure - that you should do manually with Notepad ;-) - I might have the time to illustrate my technique - at least giving you the 3 XLST scripts needed ;-)

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Babelabout
  • 445
  • 3
  • 15
1

Converting an EDI message to a flat file is a bad idea, you are probably going to loose data and message meaning. That's why EDI exists in the first place

Some ideas for parsing EDI

http://www.codeproject.com/KB/XML/edix.aspx

http://www.edidev.com/index.htm

Or Microsoft BizTalk has connectors for this too

TFD
  • 23,890
  • 2
  • 34
  • 51
  • I work as a jr programmer at logistics company and our clients send the orders via EDI and our WMS software can only handle flat files – djshortbus Mar 03 '10 at 00:05