Sparrow Technologies, Inc. Professional .NET and ActiveX components for developers
Sparrow Technologies, Inc. Home | Products | Support | Services | About Us
 EDIParser Screenshot

Screen Shots

These screen shots is from the sample .NET application.

Example of EDIParser generating an EDI HL7 message

Figure 1 shows an example EDIParser displaying a HL7 message in VB.NET.

edi parser .NET code

Module Module1

    Sub Main ()

        Dim hl7 As EDIParser.HL7Parser = New EDIParser.HL7Parser()

        hl7.SegmentSeparator = vbCrLf


        hl7.SetValue("MSH.1.1", "|")

        hl7.SetValue("MSH.2.1", "^~\&")

        hl7.SetValue("MSH.3.1", "SENDAPP")

        hl7.SetValue("MSH.4.1", "SENDAPPFAC")

        hl7.SetValue("MSH.5.1", "RECVAPP")

        hl7.SetValue("MSH.6.1", "RECVAPPFAC")

        hl7.SetValue("MSH.7.1", "20070209140300")

        hl7.SetValue("MSH.8.1", "")

        hl7.SetValue("MSH.9.1", "ADT^A01")

        hl7.SetValue("MSH.10.1", "20070209140349")

        hl7.SetValue("MSH.11.1", "P")

        hl7.SetValue("MSH.12.1", "2.3")


        hl7.SetValue("EVN.1.1", "A01") 'admit/visit

        hl7.SetValue("EVN.2.1", "20070209140300")


        hl7.SetValue("PID.2.1", "954") 'external id

        hl7.SetValue("PID.2.4", "ALT964") 'alternative id

        hl7.SetValue("PID.2.5", "MPI") 'master patient index

        hl7.SetValue("PID.3.1", "111111111") 'internal id

        hl7.SetValue("PID.5.1", "JOHN")

        hl7.SetValue("PID.5.2", "DOE")

        hl7.SetValue("PID.5.3", "E")

        hl7.SetValue("PID.7.1", "20010101000000") 'dob

        hl7.SetValue("PID.8.1", "M") 'gender

        hl7.SetValue("PID.11.1", "100 MAIN STREET")

        hl7.SetValue("PID.11.3", "GLENS FALLS")

        hl7.SetValue("PID.11.4", "NY")

        hl7.SetValue("PID.11.5", "12801")

        hl7.SetValue("PID.11.6", "US")

        hl7.SetValue("PID.18.1", "123456789") 'patient acount number





    End Sub

End Module


edi parser .net hl7 output

Figure 1 Example of EDIParser generating an EDI HL7 message

Example of EDIParser generating EDI HL7 message files from a database source

Figure 2 Example of reading patient data from a MSSQL database using ADO.NET and generating an HL7 messages using EDI Parser in VB.NET

Module Module1

    Sub Main ()


        'open database connection

        Dim connStr As String = "Data Source=[SERVER];Initial Catalog=[DATABASE];User Id=[UID];Password=[PWD]"

        Dim conn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connStr)



        'build sql command

        Dim cmd As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand

        cmd.Connection = conn

        cmd.CommandType = CommandType.Text

        cmd.CommandText = "SELECT * FROM PATIENT"


        'fill dataset

        Dim sdaPatDemo As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter(cmd)

        Dim dsPatient As DataSet = New DataSet()



        'scroll thru all the patients

        Dim dr As DataRow

        For Each dr In dsPatient.Tables(0).Rows

            Dim hl7 As EDIParser.HL7Parser = New EDIParser.HL7Parser()

            hl7.SegmentSeparator = vbCrLf


            'HL7 message header

            hl7.SetValue("MSH.1.1", "|")

            hl7.SetValue("MSH.2.1", "^~\&")

            hl7.SetValue("MSH.3.1", "SENDAPP")

            hl7.SetValue("MSH.4.1", "SENDAPPFAC")

            hl7.SetValue("MSH.5.1", "RECVAPP")

            hl7.SetValue("MSH.6.1", �RECVAPPFAC")

            hl7.SetValue("MSH.7.1", DateTime.Now.ToString("yyyyMMddhhmmss"))

            hl7.SetValue("MSH.8.1", "")

            hl7.SetValue("MSH.9.1", "ADT^A04")

            hl7.SetValue("MSH.10.1", DateTime.Now.ToString("yyyyMMddhhmmss"))

            hl7.SetValue("MSH.11.1", "P")

            hl7.SetValue("MSH.12.1", "2.3")


            'HL7 event

            hl7.SetValue("EVN.1.1", "A04") 'register patient event

            hl7.SetValue("EVN.2.1", DateTime.Now.ToString("yyyyMMddhhmmss"))


            'HL7 PID segment

            hl7.SetValue("PID.2.1", dr("ID")) 'external id

            hl7.SetValue("PID.3.1", dr("ID")) 'internal id

            hl7.SetValue("PID.5.1", dr("FirstName"))

            hl7.SetValue("PID.5.2", dr("LastName"))

            hl7.SetValue("PID.5.3", dr("MiddleInitial").ToString())

            If Not dr("DOB") Is Nothing Then

                Dim dob As DateTime = dr("DOB")

                hl7.SetValue("PID.7.1", dob.ToString("yyyyMMddhhmmss"))

            End If

            hl7.SetValue("PID.8.1", dr("Gender").ToString())

            hl7.SetValue("PID.11.1", dr("Address1").ToString())

            hl7.SetValue("PID.11.3", dr("City").ToString())

            hl7.SetValue("PID.11.4", dr("State").ToString())

            hl7.SetValue("PID.11.5", dr("ZipCode").ToString())

            hl7.SetValue("PID.11.6", dr("Country").ToString())

            hl7.SetValue("PID.13.1", dr("PhoneNumber").ToString())

            hl7.SetValue("PID.19.1", dr("SSN").ToString())


            'write message to file, prefixed by patient id

            SimpleFileWriter.WriteBuffer(dr("ID"), hl7.Message)


    End Sub

End Module

Example of EDIParser generating EDI SCRIPT message

Figure 3 shows an example EDIParser displaying a SCRIPT message in VB.NET.


Module Module1


    Sub Main ()

        Dim p As New EDIParser.EdiFactParser()


        p.SetValue("UIB.1.1", "UNOA") 'Syntax identifier

        p.SetValue("UIB.1.2", "0") 'Syntax version number

        p.SetValue("UIB.3.1", "123456") 'Transaction control #

        p.SetValue("UIB.6.1", "DOCOR NCPDP ID") 'Sender identification level one

        p.SetValue("UIB.6.2", "D") 'Sender identification code qualifier

        p.SetValue("UIB.7.1", "PHARMACY NCPDP ID") 'Recipient identification level one

        p.SetValue("UIB.7.2", "P") 'Recipient identification code qualifier

        p.SetValue("UIB.8.1", "20071101") 'Date of the interchange set by sender

        p.SetValue("UIB.8.2", "110000") 'Time of the interchange set by sender


        p.SetValue("UIH.1.1", "SCRIPT") 'Message Type

        p.SetValue("UIH.1.2", "008") 'Message version

        p.SetValue("UIH.1.3", "001") 'Message release

        p.SetValue("UIH.1.4", "NEWRX") 'Message function


        p.SetValue("PVD.1.1", "PC") 'Provider Coded

        p.SetValue("PVD.2.1", "DOCOR NCPDP ID") 'Reference Number

        p.SetValue("PVD.2.2", "D3") 'Reference qualifier

        p.SetValue("PVD.5.1", "Doe") 'Last Name

        p.SetValue("PVD.5.2", "John") 'First Name

        p.SetValue("PVD.5.3", "M"""") 'Middle Name

        p.SetValue("PVD.5.4", "MD") 'Name Suffix - Jr. III, MD, etc..

        p.SetValue("PVD.5.5", "Dr.") 'Name Prefix - Mr., Ms., Dr., etc.

        p.SetValue("PVD.7.1", "John Doe Clinic") 'Clinic name

        p.SetValue("PVD.8.1", "100 Main St") 'Address Line 1

        p.SetValue("PVD.8.2", "Chicago") 'City

        p.SetValue("PVD.8.3", "IL") 'State

        p.SetValue("PVD.8.4", "60606") 'ZIP Code

        p.SetValue("PVD.9.1", "3121111111") 'Phone Number

        p.SetValue("PVD.9.2", "TE") 'Phone Number Qualifier


        p.SetValue("PVD.1.1", "P2", 2) 'Pharmacy Coded

        p.SetValue("PVD.2.1", "123456", 2) 'Reference Number

        p.SetValue("PVD.2.2", "94", 2) 'Reference qualifier

        p.SetValue("PVD.7.1", "Walgreens", 2) 'Pharmacy name

        p.SetValue("PVD.8.1", "100 Monroe ", 2) 'Address Line 1

        p.SetValue("PVD.8.2", "Chicago", 2) 'City  

        p.SetValue("PVD.8.3", "IL", 2) 'State

        p.SetValue("PVD.8.4", "60606", 2) 'ZIP Code

        p.SetValue("PVD.9.1", "3129999999", 2) 'Phone Number

        p.SetValue("PVD.9.2", "TE", 2) 'Phone Number Qualifier


        p.SetValue("PTT.2.1", "19700215") 'Date of Birth

        p.SetValue("PTT.3.1", "Doe") 'Last Name

        p.SetValue("PTT.3.2", "Jane") 'First Name

        p.SetValue("PTT.3.3", "S") 'Middle Name

        p.SetValue("PTT.3.4", "Jr.") 'Name Suffix - Jr. III, MD, etc..

        p.SetValue("PTT.4.1", "F") 'Gender

        p.SetValue("PTT.5.1", "ID-6555") 'Reference Number

        p.SetValue("PTT.5.2", "2U") 'Reference qualifier

        p.SetValue("PTT.6.1", "100 Jackson St") 'Address Line 1

        p.SetValue("PTT.6.2", "Chicago") 'City

        p.SetValue("PTT.6.3", "IL") 'State

        p.SetValue("PTT.6.4", "60606") 'ZIP Code

        p.SetValue("PTT.7.1", "3121234567") 'Phone Number

        p.SetValue("PTT.7.2", "TE") 'Phone Number Qualifier


        p.SetValue("DRU.1.1", "P") 'Item Description Identification

        p.SetValue("DRU.1.2", "Lipitor 10 MG Tablet") 'Medication Description

        p.SetValue("DRU.1.3", "00071015523") 'Product Code

        p.SetValue("DRU.1.4", "ND") 'Product Code Qualifier

        p.SetValue("DRU.1.5", "TAB") 'Dosage Form Code

        p.SetValue("DRU.1.6", "10") 'Drug Strength

        'p.SetValue("DRU.1.7", "P") 'Drug Strength Units Coded

        p.SetValue("DRU.1.8", "47942") 'Drug Database Code

        p.SetValue("DRU.1.9", "MD") 'Drug Database Source

        p.SetValue("DRU.2.1", "EA") 'Quantity Qualifier

        p.SetValue("DRU.2.2", "15") 'Quantity

        p.SetValue("DRU.2.3", "38") 'Original Quantity

        p.SetValue("DRU.3.2", "TAKE 1 TABLET DAILY IN THE MORNING") 'SIG instructions.


        p.SetValue("DRU.4.1", "85") 'Date/Time Period Qualifier (Written Date)

        p.SetValue("DRU.4.2", "20071101") 'Date/Time Period (Written Date)

        p.SetValue("DRU.4.3", "102") 'Date/Time Period Format Qualifier


        p.SetValue("DRU.5.1", "0") 'Product/Service Substitution

        p.SetValue("DRU.6.1", "R") 'Refills

        p.SetValue("DRU.6.2", "2") 'Refill value

        p.SetValue("DRU.7.1", "1") 'Source of diagnosis code

        p.SetValue("DRU.7.2", "100") 'Diagnosis code





    End Sub


End Module

edi parser .net script output

Figure 3 Example of EDIParser generating an EDI SCRIPT message   

Example of EDIParser generating EDI X12 270 message

Figure 4 shows an example EDIParser generating an EDI X12/270 message in Microsoft .NET C#.

private static string buildX12_270()


    EDIParser.X12Parser x12_270 = new EDIParser.X12Parser();


    x12_270.SetValue("ISA.1", "00");  //No Authorization Information Present

    x12_270.SetValue("ISA.3", "00");  //No Security Information Present

    x12_270.SetValue("ISA.5", "ZZ");  //Mutually Defined

    x12_270.SetValue("ISA.6", "SENDER"); //EDI assigned Submitter ID at the time of enrollment.

    x12_270.SetValue("ISA.7", "ZZ"); //ZZ - Mutually Defined

    x12_270.SetValue("ISA.8", "RECEIVER"); //Receiver ID of the state receiving the 270 inquiry

    x12_270.SetValue("ISA.9", "090731"); //Valid date in YYMMDD format

    x12_270.SetValue("ISA.10", "1301"); //Valid time in HHMM format

    x12_270.SetValue("ISA.11", "U"); //U - U.S. EDI Community of ASC X12

    x12_270.SetValue("ISA.12", "00401"); //Draft Standards

    x12_270.SetValue("ISA.13", "000000001"); //Unique control number greater than zero

    x12_270.SetValue("ISA.14", "1"); //Acknowledgment Requested

    x12_270.SetValue("ISA.15", "P"); //P - Production Data


    x12_270.SetValue("GS.1", "HS"); //Eligibility

    x12_270.SetValue("GS.6", "1");  //Message/control number assigned by sender

    x12_270.SetValue("GS.7", "X"); //Accredited Standards Committee

    x12_270.SetValue("GS.8", "004010X092A1");


    x12_270.SetValue("ST.1", "270"); //270 - Eligibility

    x12_270.SetValue("ST.2", "0001"); //Transaction Set - Control Number, Unique value


    x12_270.SetValue("BHT.1", "0022"); //0022 - Information Source, Information Receiver, Subscriber, Dependent

    x12_270.SetValue("BHT.2", "13"); //13 - Request


    x12_270.SetValue("HL.1", "1", 1); //Hierarchical ID Number

    x12_270.SetValue("HL.3", "20", 1); //Information Source Identifies the payer

    x12_270.SetValue("HL.4", "1", 1); //Additional Subordinate HL Data Segment in this Hierarchical Structure


    x12_270.SetValue("NM1.1", "2B", 1); //Third Party Administrator

    x12_270.SetValue("NM1.2", "2", 1); //2 - Nonperson Entity

    x12_270.SetValue("NM1.3", "TRADINGPARTNER", 1); //Corresponds to Receiver/Sender Name

    x12_270.SetValue("NM1.8", "DP", 1); //Code designating the system/method of code structure used for Identification Code (Data Provider)

    x12_270.SetValue("NM1.9", "TRADREQ", 1); //Information Source Identifier (Receiver ID)


    x12_270.SetValue("HL.1", "2", 2); //Hierarchical ID Number

    x12_270.SetValue("HL.2", "1", 2); //Indicating that this HL loop is subordinate to the first HL loop

    x12_270.SetValue("HL.3", "21", 2); //Information receiver

    x12_270.SetValue("HL.4", "1", 2); //Additional Subordinate HL Data Segment in This Hierarchical Structure


    x12_270.SetValue("NM1.1", "GP", 2); //Information Source Name, GP - Gateway Provider

    x12_270.SetValue("NM1.2", "1", 2);   //Person

    x12_270.SetValue("NM1.3", "Doe", 2); //Lastname

    x12_270.SetValue("NM1.4", "Dean", 2); //Firstname

    x12_270.SetValue("NM1.8", "XX", 2);  //Code designating the system/method of code structure used

    x12_270.SetValue("NM1.9", "XXXXXXXX", 2); //Code identifying a party or other code


    x12_270.SetValue("REF.1", "EO"); //Submitter Identification Number

    x12_270.SetValue("REF.2", "4689517444002"); //Reference information as defined for a particular Transaction Set

    x12_270.SetValue("REF.3", "MyCompany"); // my company name


    x12_270.SetValue("N3.1", "123 Main Street", 1); //company street address 1


    x12_270.SetValue("N4.1", "Chicago", 1); //company city

    x12_270.SetValue("N4.2", "IL", 1); //company state

    x12_270.SetValue("N4.3", "60606", 1); //company zip


    x12_270.SetValue("HL.1", "3", 3); //Hierarchical ID Number

    x12_270.SetValue("HL.2", "2", 3); //2 - Indicating that this HL loop is subordinate to the second HL loop

    x12_270.SetValue("HL.3", "22", 3); //22- Subscriber identifies the employee or group member who is covered for the insurance

    x12_270.SetValue("HL.4", "0", 3); //0 - No Subordinate HL Segment in This Hierarchical Structure


    x12_270.SetValue("NM1.1", "IL", 3); //Insured

    x12_270.SetValue("NM1.2", "1", 3); //1 - Person

    x12_270.SetValue("NM1.3", "Doe", 3); //Last Name

    x12_270.SetValue("NM1.4", "Douglas", 3);//First Name

    x12_270.SetValue("NM1.8", "ZZ", 3); //ZZ- Mutually defined

    x12_270.SetValue("NM1.9", "813", 3); //Subscriber Primary Identifier


    x12_270.SetValue("N3.1", "123 Trumble Dr", 2); //Person street address 1

    x12_270.SetValue("N3.2", "Apt. 101", 2); //Person street address 2


    x12_270.SetValue("N4.1", "Chicago", 2); //Person city

    x12_270.SetValue("N4.2", "IL", 2); //Person state

    x12_270.SetValue("N4.3", "01040", 2); //Person zipcode


    x12_270.SetValue("DMG.1", "D8"); //D8 - Date Expressed in Format CCYYMMDD

    x12_270.SetValue("DMG.2", "19680901"); //Person birth date

    x12_270.SetValue("DMG.3", "M"); //Person gender


    x12_270.SetValue("DTP.1", "307"); //Eligibility

    x12_270.SetValue("DTP.2", "D8");// D8 - Date Expressed in Format CCYYMMDD

    x12_270.SetValue("DTP.3", "20090731"); //Expression of a date


    x12_270.SetValue("EQ.1", "88"); //88 = Pharmacy


    x12_270.SetValue("SE.1", "17"); //Total number of segments included in a transaction set including ST and SE segments

    x12_270.SetValue("SE.2", "0001"); //Identifying control number


    x12_270.SetValue("GE.1", "1"); //Total Number of Transaction Sets


    x12_270.SetValue("IEA.1", "1"); //Number of Functional Groups GS/GE Pairs in Interchange

    x12_270.SetValue("IEA.2", "000497182"); //Control Number

    return x12_270.Message();