Skip to content

Parsing An 834 Transaction

Bradley Van Fleet edited this page Aug 10, 2018 · 1 revision

Parsing an 834 Transaction

An 834 is a Benefit Enrollment transaction. This starts the health care process be specifying the coverage of each subscriber and her dependents. The following example will show you how to:

Take an 834 file and create X12 XML that shows the hieararchical relationships of the X12 segments with comments related to their values.

Take an 834 file and format it as X12 to reveal it's heirarchical relationship.

A sample 834 file that looks like this:

{code:c#} ISA00 00 019012345720000 019088877320000 0208161144U004010000000311T:~ GSBE90123457200090888773200020070816161531X004010X096A1~ ST83412345~ BGN001234561998050212002~ N1P5****FI999888777~ N1IN****FI654456654~ INSY1802120AFT~ REF0F123456789~ REF1L123456001~ DTP356D819960523~ NM1IL1DOEJOHNP34123456789~ PERIPHP7172343334WP7172341240~ N3100 MARKET STAPT 3G~ N4CAMP HILLPA17011CYCUMBERLAND~ DMGD819400816M~ HD**021HLT~ DTP348D819960601~ COBP8901115~ N1INABC INSURANCE CO~ HD**021DEN~ DTP348D819960601~ HD021**VIS~ DTP348D819960601~ SE2212345~ GE131~ IEA1**000000031~ {code:c#}

This can be parsed with the following lines of C# code: {code:c#} using System; using System.IO; using OopFactory.X12.Parsing; using OopFactory.X12.Parsing.Model;

public class Program { FileStream fstream = new FileStream("Sample1.txt", FileMode.Open, FileAccess.Read); var parser = new X12Parser(); Interchange interchange = parser.Parse(fstream); string xml = interchange.Serialize(); } {code:c#}

The resulting output xml will look like this:

{code:xml}

00 00 01 9012345720000 01 9088877320000 020816 1144 U 00401 000000031 1 T BE 901234572000 908887732000 20070816 1615 31 X 004010X096A1 834 12345 ... see [834 Sample 1 X12 XML](834-Sample-1-X12-XML) 22 12345 1 31 1 000000031 {code:xml} See full output at [834 Sample 1 X12 XML](834-Sample-1-X12-XML)

In some cases you may only want to be able to see the hierarchy in the X12 without the need for it to be xml. You can use the following code snippet to add whitespace to the stream: {code:c#} FileStream fstream = new FileStream("Sample1.txt", FileOpen.Open, FileAccess.Read); var parser = new X12Parser(); Interchange interchange = parser.Parse(fstream); string x12 = interchange.SerializeToX12(true); {code:c#}

This will produce the following output: {code:c#} ISA00 00 019012345720000 019088877320000 0208161144U004010000000311T:~ GSBE90123457200090888773200020070816161531X004010X096A1~ ST83412345~ BGN001234561998050212002~ N1P5****FI999888777~ N1IN****FI654456654~ INSY1802120AFT~ REF0F123456789~ REF1L123456001~ DTP356D819960523~ NM1IL1DOEJOHNP34123456789~ PERIPHP7172343334WP7172341240~ N3100 MARKET STAPT 3G~ N4CAMP HILLPA17011CYCUMBERLAND~ DMGD819400816M~ HD**021HLT~ DTP348D819960601~ COBP8901115~ N1INABC INSURANCE CO~ HD**021DEN~ DTP348D819960601~ HD021**VIS~ DTP348D819960601~ SE2212345~ GE131~ IEA1**000000031~ {code:c#}