views:

547

answers:

2

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

+1  A: 

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
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
+1  A: 

Hello,

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 ;-)

Regards,

Patrice, Founder of Babelabout (a not-yet-existing-business-with-an-already-happy-customer-served-for-free), http://www.babelabout.com/about.html

Babelabout