Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Parsing EDI messages

by thor (Priest)
on Oct 09, 2005 at 14:52 UTC ( #498570=note: print w/replies, xml ) Need Help??


in reply to Parsing EDI messages

There are a couple of key pieces of information (from my point of view anyways):
  • What does your message look like?
  • What does your parsing code look like?
  • In what way do the above two combine to create improper results?
Your post interests me, actually. We deal with EDIFACT at work, but I didn't know that the format was some sort of standard...

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

Replies are listed 'Best First'.
Re^2: Parsing EDI messages
by Miguel (Friar) on Oct 09, 2005 at 16:16 UTC
    Thnk you for your interest Thor.
    Altought I don't have all the answers for your questions, here is what I have now:

    My message looks like (I changed some codes):

    UNH+789+INVOIC:D:93A:UN:EAN007' BGM+380+1234567890' DTM+137:20040726:102' RFF+DQ:9087654321' RFF+ON:01234567' NAD+BY+9182736453627::9' RFF+VA:123987465' RFF+API:123' NAD+SU+123987658XXXX::9' RFF+VA:200XXXXXX' NAD+IV+1928374650981::9' CUX+2:EUR:4' LIN+1++230XXXXXXXXXX:EN' IMD+F+M+:::Pencils' QTY+47:70' MOA+66:114.45' PRI+AAB:5.36' PRI+AAA:1.64' ALC+A+++1+TD' PCD+1:69.495' UNS+S' CNT+2:1' MOA+139:138.48' MOA+79:114.45' MOA+125:114.45' MOA+176:24.03' MOA+98:375.20' TAX+7+VAT+++:::21' MOA+176:24.03' UNT+30+798'
    Now, what I want to achieve is:
    1. Validate this message against standard rules (and possibly some set of rules defined by the receiver);
    2. If is valid, create a Perl data structure, something better than this (I'm using a Data segment index from an external file):
    3. Show some informations to the user.

    My problems are:

    1. How to apply the rules (the 'standard' and others defined by the receiver)? There are 100s (perhaps 1000s) of constraints to check. How to do the mappings?
    2. How to construct a solid, fast and accurate data structure that allows me to extract any kind of information from an EDI message?
    Hope this helps.
    Miguel

    Edit: g0n - Added readmore tags

      My problems are:
      1. How to apply the rules (the 'standard' and others defined by the receiver)? There are 100s (perhaps 1000s) of constraints to check. How to do the mappings?
      2. How to construct a solid, fast and accurate data structure that allows me to extract any kind of information from an EDI message?
      I can't speak to the first (showing an example or three of a "rule" might help), but the second almost says database to me. Data structures are geared well towards doing things in a certain way. For instance, if you create a data structure based on people, you could structure it as a hash of hashes, with family name as the primary key and individuals as the sub-keys. Finding how many people are males over 25 from this structure isn't pretty. It seems that you want more flexiblity in the way that you get data out of the parsed message. As it stands, your initial structure didn't look that bad. The only complaint that I'd have against it is the existance of non-descriptive keys at the first level (they're all numbers which don't convey any information to me). After that, everything starts to fall into place.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2021-10-19 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (76 votes). Check out past polls.

    Notices?