'This is an example C# source code for generating an EDI X12 275X210 using the Framework EDI component.
'The complete sample program can be downloaded from our HIPAA EDI Support webpage at http://www.edidev.com/example_hipaa.html 


    private void btnGenerate_Click(object sender, EventArgs e)
        {
            // Generates 275 Patient Information - Additional Information to Support a Health Care Claim or Encounter

            ediDocument oEdiDoc;
            ediSchema oSchema;
            ediSchemas oSchemas;
            ediInterchange oInterchange;
            ediGroup oGroup;
            ediTransactionSet oTransactionSet;
            ediDataSegment oSegment;
            string sEdiFileName = "";
            string sSefFileName = "";

            string sPath = AppDomain.CurrentDomain.BaseDirectory;

            // Create the top-level application object "ediDocument". 
            oEdiDoc = new ediDocument();

            // This makes certain that Framework EDI only uses the SEF file provided, 
            // and that it does not use its built-in Standard Reference table to generate 
            // the EDI document 
            oSchemas = (ediSchemas)oEdiDoc.GetSchemas();
            oSchemas.EnableStandardReference = false;

            // The FORWARD-WRITE cursor increases the performance of processing the EDI 
            // document (see Technical Note 3 below). 
            oEdiDoc.CursorType = DocumentCursorTypeConstants.Cursor_ForwardWrite;

            // Terminators have to be specified. 
            oEdiDoc.SegmentTerminator = "~{13:10}";
            oEdiDoc.ElementTerminator = "*";
            oEdiDoc.CompositeTerminator = "!";

            sEdiFileName = "275_5010X210.X12";
            sSefFileName = "275_005010X210.SemRef.SEF";  //evaluation SEF file

            // Specify SEF file to load. 
            oSchema = (ediSchema)oEdiDoc.LoadSchema(sSefFileName, SchemaTypeIDConstants.Schema_Standard_Exchange_Format);

            // Creates the Interchange Control Header segment (ISA). 
            oInterchange = (ediInterchange)oEdiDoc.CreateInterchange("X", "005010");
            oSegment = (ediDataSegment)oInterchange.GetDataSegmentHeader();
            oSegment.set_DataElementValue(1, 0, "00");         // Authorization Information Qualifier (I01) 
            oSegment.set_DataElementValue(2, 0, "          ");         // Authorization Information (I02) 
            oSegment.set_DataElementValue(3, 0, "00");         // Security Information Qualifier (I03) 
            oSegment.set_DataElementValue(4, 0, "          ");         // Security Information (I04) 
            oSegment.set_DataElementValue(5, 0, "ZZ");         // Interchange ID Qualifier (I05) 
            oSegment.set_DataElementValue(6, 0, "SENDER ID      ");         // Interchange Sender ID (I06) 
            oSegment.set_DataElementValue(7, 0, "ZZ");         // Interchange ID Qualifier (I05) 
            oSegment.set_DataElementValue(8, 0, "RECEIVER ID    ");         // Interchange Receiver ID (I07) 
            oSegment.set_DataElementValue(9, 0, "010101");         // Interchange Date (I08) 
            oSegment.set_DataElementValue(10, 0, "0101");         // Interchange Time (I09) 
            oSegment.set_DataElementValue(11, 0, ":");         // Repetition Separator (I65) 
            oSegment.set_DataElementValue(12, 0, "00501");         // Interchange Control Version Number (I11) 
            oSegment.set_DataElementValue(13, 0, "000000001");         // Interchange Control Number (I12) 
            oSegment.set_DataElementValue(14, 0, "0");         // Acknowledgment Requested (I13) 
            oSegment.set_DataElementValue(15, 0, "T");         // Usage Indicator (I14) 
            oSegment.set_DataElementValue(16, 0, "!");         // Component Element Separator (I15) 

            // Creates the Functional Group Header segment (GS). 
            oGroup = (ediGroup)oInterchange.CreateGroup("005010X210");
            ediDataSegment.Set(ref oSegment, (ediDataSegment)oGroup.GetDataSegmentHeader());
            oSegment.set_DataElementValue(1, 0, "PI");         // Functional Identifier Code (479) 
            oSegment.set_DataElementValue(2, 0, "APP SENDER");         // Application Sender's Code (142) 
            oSegment.set_DataElementValue(3, 0, "APP RECEIVER");         // Application Receiver's Code (124) 
            oSegment.set_DataElementValue(4, 0, "01010101");         // Date (373) 
            oSegment.set_DataElementValue(5, 0, "01010101");         // Time (337) 
            oSegment.set_DataElementValue(6, 0, "1");         // Group Control Number (28) 
            oSegment.set_DataElementValue(7, 0, "X");         // Responsible Agency Code (455) 
            oSegment.set_DataElementValue(8, 0, "005010X210");         // Version / Release / Industry Identifier Code (480) 

            // TRANSACTION SET ID 275 - Patient Information 

            // Creates the Transaction Set header segment (ST). 
            oTransactionSet = (ediTransactionSet)oGroup.CreateTransactionSet("275");
            ediDataSegment.Set(ref oSegment, (ediDataSegment)oTransactionSet.GetDataSegmentHeader());
            oSegment.set_DataElementValue(1, 0, "275");         // Transaction Set Identifier Code (143) 
            oSegment.set_DataElementValue(2, 0, "0001");         // Transaction Set Control Number (329) 
            oSegment.set_DataElementValue(3, 0, "005010X210");         // Implementation Convention Reference (1705) 


            // Beginning Segment (BGN) 
            oSegment = oTransactionSet.CreateDataSegment("BGN");
            oSegment.set_DataElementValue(1, 0, "11");         // Transaction Set Purpose Code (353) 
            oSegment.set_DataElementValue(2, 0, "0001");         // Reference Identification (127) 
            oSegment.set_DataElementValue(3, 0, "20060915");         // Date (373) 

            // LOOP ID - 1000A PAYER NAME
            oSegment = oTransactionSet.CreateDataSegment(@"NM1\NM1");
            oSegment.set_DataElementValue(1, 0, "PR");         // Entity Identifier Code (98) 
            oSegment.set_DataElementValue(2, 0, "2");         // Entity Type Qualifier (1065) 
            oSegment.set_DataElementValue(3, 0, "ABC INSURANCE COMPANY");         // Name Last or Organization Name (1035) 
            oSegment.set_DataElementValue(8, 0, "XV");         // Identification Code Qualifier (66) 
            oSegment.set_DataElementValue(9, 0, "12345");         // Identification Code (67) 

            // LOOP ID - 1000B SUBMITTER INFORMATION
            oSegment = oTransactionSet.CreateDataSegment(@"NM1\NM1");
            oSegment.set_DataElementValue(1, 0, "41");         // Entity Identifier Code (98) 
            oSegment.set_DataElementValue(2, 0, "2");         // Entity Type Qualifier (1065) 
            oSegment.set_DataElementValue(3, 0, "XYZ SERVICES");         // Name Last or Organization Name (1035) 
            oSegment.set_DataElementValue(8, 0, "46");         // Identification Code Qualifier (66) 
            oSegment.set_DataElementValue(9, 0, "A222222221");         // Identification Code (67) 

            // LOOP ID - 1000C PROVIDER NAME INFORMATION
            oSegment = oTransactionSet.CreateDataSegment(@"NM1\NM1");
            oSegment.set_DataElementValue(1, 0, "1P");         // Entity Identifier Code (98) 
            oSegment.set_DataElementValue(2, 0, "2");         // Entity Type Qualifier (1065) 
            oSegment.set_DataElementValue(3, 0, "ST HOLY HILLS HOSPITAL");         // Name Last or Organization Name (1035) 
            oSegment.set_DataElementValue(8, 0, "XX");         // Identification Code Qualifier (66) 
            oSegment.set_DataElementValue(9, 0, "3999000B01");         // Identification Code (67) 


            // LOOP ID - 1100C PROVIDER IDENTIFICATION
            oSegment = oTransactionSet.CreateDataSegment(@"NM1\NX1\NX1");
            oSegment.set_DataElementValue(1, 0, "1P");         // Entity Identifier Code (98) 

            // Provider Address
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"NM1\NX1\N3"));
            oSegment.set_DataElementValue(1, 0, "2345 Winter Blvd");         // Address Information (166) 

            // Provider City, State, ZIP Code 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"NM1\NX1\N4"));
            oSegment.set_DataElementValue(1, 0, "Miami");         // City Name (19) 
            oSegment.set_DataElementValue(2, 0, "FL");         // State or Province Code (156) 
            oSegment.set_DataElementValue(3, 0, "33132");         // Postal Code (116) 

            // LOOP ID - 1000D PATIENT NAME
            oSegment = oTransactionSet.CreateDataSegment(@"NM1\NM1");
            oSegment.set_DataElementValue(1, 0, "QC");         // Entity Identifier Code (98) 
            oSegment.set_DataElementValue(2, 0, "1");         // Entity Type Qualifier (1065) 
            oSegment.set_DataElementValue(3, 0, "JACKSON");         // Name Last or Organization Name (1035) 
            oSegment.set_DataElementValue(4, 0, "JACK");         // Name First (1036) 
            oSegment.set_DataElementValue(5, 0, "J");         // Name Middle (1037) 
            oSegment.set_DataElementValue(8, 0, "MI");         // Identification Code Qualifier (66) 
            oSegment.set_DataElementValue(9, 0, "987654320~");         // Identification Code (67) 

            // REF - PATIENT CONTROL NUMBER 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"NM1\REF"));
            oSegment.set_DataElementValue(1, 0, "EJ");         // Reference Identification Qualifier (128) 
            oSegment.set_DataElementValue(2, 0, "JACKSON123");         // Reference Identification (127) 

            // REF - MEDICAL RECORD IDENTIFICATION NUMBER
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"NM1\REF"));
            oSegment.set_DataElementValue(1, 0, "EA");         // Reference Identification Qualifier (128) 
            oSegment.set_DataElementValue(2, 0, "STHHL12345");         // Reference Identification (127) 

            // DTP - CLAIM SERVICE DATE
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"NM1\DTP"));
            oSegment.set_DataElementValue(1, 0, "472");         // Date/Time Qualifier (374) 
            oSegment.set_DataElementValue(2, 0, "D8");         // Date Time Period Format Qualifier (1250) 
            oSegment.set_DataElementValue(3, 0, "20060812");         // Date Time Period (1251) 

            // LX - ASSIGNED NUMBER
            oSegment = oTransactionSet.CreateDataSegment(@"LX\LX");
            oSegment.set_DataElementValue(1, 0, "1");         // Assigned Number (554) 

            // TRN - PAYER CLAIM CONTROLNUMBER/PROVIDER ATTACHMENT CONTROL NUMBER 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\TRN"));
            oSegment.set_DataElementValue(1, 0, "2");         // Trace Type Code (481) 
            oSegment.set_DataElementValue(2, 0, "1822634840");         // Reference Identification (127) 

            // STC - STATUS INFORMATION 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\STC"));
            oSegment.set_DataElementValue(1, 1, "R4");         // Industry Code (1271) 
            oSegment.set_DataElementValue(1, 2, "18626-2");         // Industry Code (1271) 
            oSegment.set_DataElementValue(1, 4, "LOI");         // Code List Qualifier Code (1270) 
            
            // DTP - ADDITIONAL INFORMATION SUBMISSION DATE 
            oSegment = oTransactionSet.CreateDataSegment(@"LX\DTP\DTP");
            oSegment.set_DataElementValue(1, 0, "368");         // Date/Time Qualifier (374) 
            oSegment.set_DataElementValue(2, 0, "D8");         // Date Time Period Format Qualifier (1250) 
            oSegment.set_DataElementValue(3, 0, "20060915");         // Date Time Period (1251) 

            // CAT - CATEGORY OF PATIENT INFORMATION SERVICE 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\DTP\CAT"));
            oSegment.set_DataElementValue(1, 0, "AE");         // Report Type Code (755) 
            oSegment.set_DataElementValue(2, 0, "TX");         // Report Transmission Code (756) 

            // EFI - ELECTRONIC FORMAT IDENTIFICATION 
            oSegment = oTransactionSet.CreateDataSegment(@"LX\DTP\EFI\EFI");
            oSegment.set_DataElementValue(1, 0, "05");         // Security Level Code (786) 

            // BIN - BINARY DATA SEGMENT 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\DTP\EFI\BIN"));
            //oSegment.set_DataElementValue(1, 0, "");         // ' Length of Binary Data (784) automatically calculated and entered by FREDI
            oSegment.get_DataElement(2).ImportValue(sPath + @"\import\edidevpic.gif");     //sample binary file


            // LX - ASSIGNED NUMBER 
            oSegment = oTransactionSet.CreateDataSegment(@"LX\LX");
            oSegment.set_DataElementValue(1, 0, "2");         // Assigned Number (554) 

            // TRN - PAYER CLAIM CONTROLNUMBER/PROVIDER ATTACHMENT CONTROL NUMBER 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\TRN"));
            oSegment.set_DataElementValue(1, 0, "2");         // Trace Type Code (481) 
            oSegment.set_DataElementValue(2, 0, "1822634840");         // Reference Identification (127) 

            // STC - STATUS INFORMATION 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\STC"));
            oSegment.set_DataElementValue(1, 1, "R4");         // Industry Code (1271) 
            oSegment.set_DataElementValue(1, 2, "18647-8");         // Industry Code (1271) 
            oSegment.set_DataElementValue(1, 4, "LOI");         // Code List Qualifier Code (1270) 

            // DTP - ADDITIONAL INFORMATION SUBMISSION DATE 
            oSegment = oTransactionSet.CreateDataSegment(@"LX\DTP\DTP");
            oSegment.set_DataElementValue(1, 0, "368");         // Date/Time Qualifier (374) 
            oSegment.set_DataElementValue(2, 0, "D8");         // Date Time Period Format Qualifier (1250) 
            oSegment.set_DataElementValue(3, 0, "20060915");         // Date Time Period (1251) 


            // CAT - CATEGORY OF PATIENT INFORMATION SERVICE 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\DTP\CAT"));
            oSegment.set_DataElementValue(1, 0, "AE");         // Report Type Code (755) 
            oSegment.set_DataElementValue(2, 0, "TX");         // Report Transmission Code (756) 

            // EFI - ELECTRONIC FORMAT IDENTIFICATION 
            oSegment = oTransactionSet.CreateDataSegment(@"LX\DTP\EFI\EFI");
            oSegment.set_DataElementValue(1, 0, "05");         // Security Level Code (786) 

            // BIN - BINARY DATA SEGMENT 
            ediDataSegment.Set(ref oSegment, oTransactionSet.CreateDataSegment(@"LX\DTP\EFI\BIN"));
            //oSegment.set_DataElementValue(1, 0, "");         // ' Length of Binary Data (784) automatically calculated and entered by FREDI
            oSegment.get_DataElement(2).ImportValue(sPath + @"\import\sampleText.txt");     //sample binary file

            // Trailing segments are automatically created when Framework EDI commits 
            // (saves) the instance of "oEdiDoc" object into an EDI file. 
            oEdiDoc.Save(sEdiFileName, 0);
            
            //Display EDI file
            frmViewEdi oViewEdi = new frmViewEdi();
            oViewEdi.sEdiFile = oEdiDoc.GetEdiString();
            oViewEdi.Show();

            //destroy objects
            oSegment.Dispose();
            oTransactionSet.Dispose();
            oGroup.Dispose();
            oInterchange.Dispose();
            oSchema.Dispose();
            oSchemas.Dispose();
            oEdiDoc.Dispose();

        }
    

    Click here to download a trial version of the Framework EDI