I don't know of any X12 EDI perl modules, but I used to work for a company that did EDI (I even wrote a perl program that colorized/pretty-formatted X12 EDI). The following is purely from memory and may not be quoite right, but I hope you find it helpful.

X12 EDI documents are basically deimited files (i.e. split works great on them). Their are record separators, element separators, and sub-element separators. The first record in any X12 document is the ISA header, and this is fixed-length, so you can use it to find what all the separators are.

Once you know the separators, if you split the document on the record separator, you'll see its structured as follows (indentation added for clarity). If you then separate each record into elements by splitting on the element separator, the first element of each record is its record type:


ISA
  GS
    ST
      .. one transaction in here
    SE
    ST
      ..
    SE
  GE
  GS
    ...
  GE
IEA

i.e. the ISA/IEA records are the "document header and footer", it can contain one or more groups (delimited by GS/GE), each group contains one or more transactions (delimited by ST/SE). These ST/SE are the individual transactions (your 850, among others)

The 2 outer envelopes (ISA/IEA and GS/GE) contain routing information that indicates how to deliver the transcations. Within the ST/SE section are all the records that make up the individual 850. I don't remember what the exact records are.

Within the ST/SE block each record corresponds to specific information about the transaction.

That's about all I can remember for now. I'll post more if I can remember any other information in the structure of 850s....


In reply to Re: 850 EDI Help by lhoward
in thread 850 EDI Help by the_Don

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.