Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: 850 EDI Help

by lhoward (Vicar)
on Oct 02, 2002 at 11:34 UTC ( #202235=note: print w/replies, xml ) Need Help??

in reply to 850 EDI Help

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:

      .. one transaction in here

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....

Replies are listed 'Best First'.
Re: Re: 850 EDI Help
by jordanh (Chaplain) on Oct 02, 2002 at 11:52 UTC
    ++ Good overview. A couple of additional points.

    With Revision 004030, they've added a new separator, the Repetition Separator character, which is located at ISA11. ISA11 is the 11th element in the ISA segment. You'll see that terminology a lot. GS02 (the second element in the GS), for example, is the sender's Application ID and GS03 is the receiver's Application ID. You can split a given segment up into elements using the Element Separator, which just happens to be the 4th character of the ISA segment.

    The two important separators are the segment terminator, with is the 106th character of the ISA (the ISA is the only fixed size segment... hmmm... maybe IEA is fixed size too) and the element separator is the 4th character. The component separator is the 105th character of the ISA, but it's rarely used (not used at all in 850 document IIRC). I don't know where the Repetition separator is used, but it must be even rarer than the Component separator as I've never seen it in use.

    The ISA/GS segments contain information pertaining to addressing of the document and other header type information like EDI version and date/time stamps, etc.

    If you find standards documents for your partner, these will typically explain what the standards are for what goes in between the ST/SE pairs.

    Hope this helps.

      God I'd love some EDI modules, I evaluate 856s for correct shipment segment population (among other things) and I find myself reinventing the wheel far to many times. I'd post my own scripts but they lack any sort of optimization (in one task I open the same 160+ mg file several times just to do another "while search").
        There certainly is demand out there for some Perl tools for handling EDI. As I said above, see this discussion. There might be a critical mass of people interested in this.

        From my watching the Open Source scene, it'll really require someone to stand up and start putting code out there for it to work, but someone doing such a thing could sure use testing and feedback.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://202235]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2023-02-05 14:30 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (31 votes). Check out past polls.