how to translate EDI X12 documents

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There's no plug-in for that that I know of and one would typically use the "TX" product for things of that nature. Otherwise it's going to be something you'd need to tear apart yourself. From looking at the format it doesn't look like it would be too bad to handle. :wink:

Read the file as one long string and then based on the first field, parse each record type accordingly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArjunK
Participant
Posts: 30
Joined: Sun Apr 30, 2006 6:32 pm

Post by ArjunK »

I have done some EDI846 translations and as Chulett mentioned you will need to extract data by looking at the segments.

Since, the entire document comes in a single line , first you can use the "segment delimiter" in the document and replace that with a newline "\n" to get each segment into a separate line. This can be done using a script ( shell/perl).

Then using a sequential file stage read the entire document as a single varchar field.

Next use a transformer to look for the segments type and extract the indivisual fields by looking at the Field Delimiters. You will probably have to run the transformer in sequential mode since the order in which you parse the segments has to be maintained.

Hope that helps.
Post Reply