20

Initially I was thinking to use SSIS to parse an EDI file, however I've seen a few manual EDI parsers (field mapping), and would like to use automate this functionality in C#.

Example EDI File:

Example EDI File

cleftheris
  • 4,626
  • 38
  • 55
ElHaix
  • 12,846
  • 27
  • 115
  • 203

5 Answers5

17

There is EDI.Net library which is opensource and supports all three known EDI formats (X12, EDIFact, Tradacoms). In your case for X12 you need to provide a custom implementation of the IEdiGrammar with the following presets.

public class EDI_X12Grammar : IEdiGrammar
{
...
}

var grammar = new EDI_X12Grammar() 
       {
            ComponentDataElementSeparator = new[] { '>' },
            DataElementSeparator = new[] { '*' },
            DecimalMark = null,
            ReleaseCharacter = null,
            Reserved = new char[0],
            SegmentTerminator = '~',
            ServiceStringAdviceTag = null,
            InterchangeHeaderTag = "ISA",
            FunctionalGroupHeaderTag = "GS",
            MessageHeaderTag = "ST",
            MessageTrailerTag = "SE",
            FunctionalGroupTrailerTag = "GE",
            InterchangeTrailerTag = "IEA",
        };

Disclaimer I wrote the library.

cleftheris
  • 4,626
  • 38
  • 55
  • Hi. I want to use your library but it seems I need to use ASP.net Core? What framework version should I use please? Thanks – Fandango68 Feb 14 '18 at 06:25
  • 1
    @Fandango68 it is build with the new dotnetcore sdk tooling but it is not limited to that. It is available in Full .Netframework 4.5 and later. Check the [supported frameworks on nuget.org](https://www.nuget.org/packages/indice.Edi/) to see the list open the Dependencies section. – cleftheris Feb 14 '18 at 08:37
  • I think this is what I'm looking for but I can find no documentation on support for 271 doc anywhere. – Ron Sep 10 '19 at 19:51
  • @Ron This is the serializer so you can find samples on how to build a transmision but may not have a transmission ready for the 271. You have to build the POCO models your self. Check the [samples](https://github.com/indice-co/EDI.Net/tree/master/test/indice.Edi.Tests/Models) on the test project – cleftheris Sep 11 '19 at 09:58
  • 1
    I tried the above mention library and it was great. I created blogged about here with some good examples: http://mylifeismymessage.net/edi-net-library-for-processing-edi-files/ – NealWalters Jun 28 '20 at 20:01
8

Have you seen http://www.codeproject.com/KB/XML/edix.aspx

Joe
  • 721
  • 9
  • 22
2

This is for X12 and worked pretty well for my uses:

http://x12parser.codeplex.com/

It's command line, and just outputs an XML file for your EDI file.

You could possibly adapt it for your purposes.

Paul Tyng
  • 7,924
  • 1
  • 33
  • 57
1

I'm not familiar with the EDI file format, but would either of these help:

cfbarbero
  • 1,607
  • 2
  • 14
  • 26
0

I am not sure if you are open to commercial tools, but I am throwing this link out here just in case. It might help somebody. Disclaimer: I am not connected in any way to this provider.

FRAMEWORK EDI - EDI Tools for Programmer (Commercial Framework) - Find it here: http://www.edidev.com/

MarlonRibunal
  • 4,009
  • 3
  • 31
  • 37