About EasyMorph Tutorials & Examples Web-help

How to parse EDI file (e.g. X12 transaction set 837)

EDI files may look cryptic however it is possible to parse them in EasyMorph.

Below is an (incomplete) example of parsing a sample ASC X12 transaction form 837 data file. An EDI file is effectively a text file that consists of records. Each record have a variable number of values separated by a delimiter. The first 1-2 values determine the record type which specified the information encoded in the rest of values in the record.

N4*MIAMI*FL*33111~

For instance, in the record above there are 4 values separated by * (the delimiter). The tilda ~ at the end denotes the end of record. The first value (N4) denotes the record type, which in case of specification X12 transaction set 837 is a part of an address. The rest of values is city (MIAMI), state (FL), and zip code (33111).

Records can be bundled into blocks. In this example, the record above is part of a group of 4 records, which according to the specification of the transaction set 837 is group 2010AA (BILLING PROVIDER):

NM1*85*2*BEN KILDARE SERVICE*****XX*9876543210~
N3*234 SEAWAY ST~
N4*MIAMI*FL*33111~
REF*EI*587654321~

An EDI X12 file consists of a header, blocks of records, and terminating record. Here is a specification of the structure of the 837 set used in this example: https://x12.org/examples/005010x222/example-1-commercial-health-insurance

In order to parse such EDI file in EasyMorph, we need to identify the blocks of records, then parse each block line by line, according to the format specification. Each block can be parsed into 1 or more columns (each with a single value), which then are appended side-by-side into a single table row. One row represents one transaction. Finally, all rows are appended into a table because one EDI file can contain multiple transactions.

Example files:
edi-837.morph (28.7 KB)
837-example.txt (993 Bytes)

Module "Main"


This screenshot shows pre-parsed EDI file, and the result table with parsed EDI data.

Module “Build line” tab "2010AA BILLING PROVIDER"


This screenshot shows how the block of records described above is parsed in EasyMorph.

To learn more about EasyMorph visit easymorph.com.