procedure TForm1.Button1Click(Sender: TObject);
    // THIS IS JUST AN EXAMPLE PROGRAM TO DEMONSTRATE HOW TO TRANSLATE AN EDI X12 211 FILE 
    // USING THE FRAMEWORK EDI COMPONENT IN DELPHI
    var
       oEdiDoc: IediDocument;
       oSchemas: IediSchemas;
       oSegment: IediDataSegment;
       sSegmentID: String;
       sLoopID: String;
       nArea: Integer;
       sValue: String;
       sLoopQlfr: String;
       sQlfr: String;
 
    begin
       // CREATES EDI DOCUMENT OBJECT
       oEdidoc := coedidocument.Create;
 
       // THIS MAKES CERTAIN THAT FREDI ONLY USES THE SEF FILE PROVIDED, AND THAT IT DOES 
       // NOT USE ITS BUILT-IN STANDARD REFERENCE TABLE TO TRANSLATE THE EDI FILE.
       oSchemas := oEdiDoc.GetSchemas as IediSchemas;
       oSchemas.EnableStandardReference := false;
 
       // STOPS FREDI FROM KEEPING ALL THE SEGMENTS IN MEMORY
       oEdiDoc.CursorType := 1;
 
       // LOADS THE SEF FILE
       oEdidoc.LoadSchema('211_003070.SEF',0);
 
       // LOADS THE EDI FILE
       oEdiDoc.LoadEdi('211.X12');
 
       // GETS THE FIRST DATA SEGMENT
       oSegment := oEdiDoc.FirstDataSegment as IediDataSegment;
 
       // LOOP THAT WILL TRAVERSE THRU THE EDI FILE FROM TOP TO BOTTOM
       while oSegment <> Nil do begin
 
          // DATA SEGMENTS WILL BE IDENTIFIED BY THEIR ID, THE LOOP SECTION AND AREA
          // (OR TABLE) NUMBER THAT THEY ARE IN.
          nArea := oSegment.Area;
          sLoopID := oSegment.LoopSection;
          sSegmentID := oSegment.ID;
 
          if nArea = 0 then begin
             if sLoopID = '' then begin
                if sSegmentID = 'ISA' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Authorization Information Qualifier
                   sValue := oSegment.DataElementValue[2,0];     // Authorization Information
                   sValue := oSegment.DataElementValue[3,0];     // Security Information Qualifier
                   sValue := oSegment.DataElementValue[4,0];     // Security Information
                   ListBox1.Items.Add(oSegment.DataElement[5].Description + ' = ' + oSegment.DataElementValue[5,0]);     // Interchange ID Qualifier
                   ListBox1.Items.Add(oSegment.DataElement[6].Description + ' = ' + oSegment.DataElementValue[6,0]);     // Interchange Sender ID
                   sValue := oSegment.DataElementValue[7,0];     // Interchange ID Qualifier
                   sValue := oSegment.DataElementValue[8,0];     // Interchange Receiver ID
                   sValue := oSegment.DataElementValue[9,0];     // Interchange Date
                   sValue := oSegment.DataElementValue[10,0];     // Interchange Time
                   sValue := oSegment.DataElementValue[11,0];     // Interchange Control Standards Identifier
                   sValue := oSegment.DataElementValue[12,0];     // Interchange Control Version Number
                   ListBox1.Items.Add(oSegment.DataElement[13].Description + ' = ' + oSegment.DataElementValue[13,0]);     // Interchange Control Number
                   sValue := oSegment.DataElementValue[14,0];     // Acknowledgment Requested
                   sValue := oSegment.DataElementValue[15,0];     // Usage Indicator
                   sValue := oSegment.DataElementValue[16,0];     // Component Element Separator
                end
                else if sSegmentID = 'GS' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Functional Identifier Code
                   sValue := oSegment.DataElementValue[2,0];     // Application Sender's Code
                   sValue := oSegment.DataElementValue[3,0];     // Application Receiver's Code
                   sValue := oSegment.DataElementValue[4,0];     // Date
                   sValue := oSegment.DataElementValue[5,0];     // Time
                   ListBox1.Items.Add(oSegment.DataElement[6].Description + ' = ' + oSegment.DataElementValue[6,0]);     // Group Control Number
                   sValue := oSegment.DataElementValue[7,0];     // Responsible Agency Code
                   sValue := oSegment.DataElementValue[8,0];     // Version / Release / Industry Identifier Code
                end;   //sSegmentID
             end;   //sLoopID
          end
          else if nArea = 1 then begin
             if sLoopID = '' then begin
                if sSegmentID = 'ST' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Transaction Set Identifier Code
                   ListBox1.Items.Add(oSegment.DataElement[2].Description + ' = ' + oSegment.DataElementValue[2,0]);     // Transaction Set Control Number
                end
                else if sSegmentID = 'BOL' then begin
                                svalue := oSegment.DataElement[2].Description;

                   sValue := oSegment.DataElementValue[1,0];     // Standard Carrier Alpha Code
                   sValue := oSegment.DataElementValue[2,0];     // Shipment Method of Payment
                   ListBox1.Items.Add(oSegment.DataElement[3].Description + ' = ' + oSegment.DataElementValue[3,0]);     // Shipment Identification Number
                   ListBox1.Items.Add(oSegment.DataElement[4].Description + ' = ' + oSegment.DataElementValue[4,0]);     // Date
                   sValue := oSegment.DataElementValue[5,0];     // Time
                   sValue := oSegment.DataElementValue[6,0];     // Reference Identification
                end
                else if sSegmentID = 'B2A' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Transaction Set Purpose Code
                end
                else if sSegmentID = 'MS2' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Standard Carrier Alpha Code
                   sValue := oSegment.DataElementValue[2,0];     // Equipment Number
                end;   //sSegmentID
             end
             else if sLoopID = 'N1' then begin
                // If loop has more that one instance, then you should check for the qualifier that differentiates the loop instances here
                If sSegmentID = 'N1' then begin
                   sLoopQlfr := oSegment.DataElementValue[1,0];   // In most cases the loop qualifier is the first element of the first segment in the loop, but not necessarily
                end;

                If sLoopQlfr = 'SH' then begin
                   if sSegmentID = 'N1' then begin
                      sValue := oSegment.DataElementValue[1,0];     // Entity Identifier Code
                      ListBox1.Items.Add('Shipper Name = ' + oSegment.DataElementValue[2,0]);     // Name
                      sValue := oSegment.DataElementValue[3,0];     // Identification Code Qualifier
                      sValue := oSegment.DataElementValue[4,0];     // Identification Code
                   end
                   else if sSegmentID = 'N3' then begin
                      ListBox1.Items.Add('Shipper Address = ' + oSegment.DataElementValue[1,0]);     // Address Information
                      sValue := oSegment.DataElementValue[2,0];     // Address Information
                   end
                   else if sSegmentID = 'N4' then begin
                      ListBox1.Items.Add('Shipper City = ' + oSegment.DataElementValue[1,0]);     // City Name
                      sValue := oSegment.DataElementValue[2,0];     // State or Province Code
                      sValue := oSegment.DataElementValue[3,0];     // Postal Code
                   end;   //sSegmentID
                end
                else if sLoopQlfr = 'CN' then begin
                   if sSegmentID = 'N1' then begin
                      sValue := oSegment.DataElementValue[1,0];     // Entity Identifier Code
                      ListBox1.Items.Add('Consignee Name = ' + oSegment.DataElementValue[2,0]);     // Name
                      sValue := oSegment.DataElementValue[3,0];     // Identification Code Qualifier
                      sValue := oSegment.DataElementValue[4,0];     // Identification Code
                   end
                   else if sSegmentID = 'N3' then begin
                      ListBox1.Items.Add('Consignee Address = ' + oSegment.DataElementValue[1,0]);     // Address Information
                      sValue := oSegment.DataElementValue[2,0];     // Address Information
                   end
                   else if sSegmentID = 'N4' then begin
                      ListBox1.Items.Add('Consignee City = ' + oSegment.DataElementValue[1,0]);     // City Name
                      sValue := oSegment.DataElementValue[2,0];     // State or Province Code
                      sValue := oSegment.DataElementValue[3,0];     // Postal Code
                   end
                   else if sSegmentID = 'G61' then begin
                      sQlfr := oSegment.DataElementValue[1,0];     // Contact Function Code
                      if sQlfr = 'DC' then begin
                         ListBox1.Items.Add('Delivery Contact Name = ' + oSegment.DataElementValue[2,0]);     // Name
                      end;
                      sQlfr := oSegment.DataElementValue[3,0];     // Communication Number Qualifier
                      if sQlfr = 'TE' then begin
                         ListBox1.Items.Add('Delivery Contact Telephone Number = ' + oSegment.DataElementValue[4,0]);     // Communication Number
                      end;
                   end;   //sSegmentID
                end;   //sLoopQlfr
             end;   //sLoopID
          end
          else if nArea = 2 then begin
             if sLoopID = 'AT1' then begin
                if sSegmentID = 'AT1' then begin
                    //sValue := oSegment.DataElement[1].Description;
                   sValue := oSegment.DataElementValue[1,0];     // Lading Line Item Number
                end
                else if sSegmentID = 'L11' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Reference Identification
                   sValue := oSegment.DataElementValue[2,0];     // Reference Identification Qualifier
                end
                else if sSegmentID = 'AT4' then begin
                   sValue := oSegment.DataElementValue[1,0];     // Lading Description
                end;   //sSegmentID
             end
             else if sLoopID = 'AT1;AT2' then begin
                if sSegmentID = 'AT2' then begin
                    //sValue := oSegment.DataElement[1].Description;
                   ListBox1.Items.Add(oSegment.DataElement[1].Description + ' = ' + oSegment.DataElementValue[1,0]);     // Lading Quantity
                   sValue := oSegment.DataElementValue[2,0];     // Packaging Form Code
                   sValue := oSegment.DataElementValue[3,0];     // Weight Qualifier
                   sValue := oSegment.DataElementValue[4,0];     // Weight Unit Code
                   sValue := oSegment.DataElementValue[5,0];     // Weight
                   ListBox1.Items.Add(oSegment.DataElement[6].Description + ' = ' + oSegment.DataElementValue[6,0]);     // Lading Quantity
                   sValue := oSegment.DataElementValue[7,0];     // Packaging Form Code
                   sValue := oSegment.DataElementValue[8,0];     // Yes/No Condition or Response Code
                   ListBox1.Items.Add(oSegment.DataElement[9].Description + ' = ' + oSegment.DataElementValue[9,0]);     // Commodity Code
                end
                else if sSegmentID = 'MAN' then begin

                   sValue := oSegment.DataElementValue[1,0];     // Marks and Numbers Qualifier
                   ListBox1.Items.Add(oSegment.DataElement[2].Description + ' = ' + oSegment.DataElementValue[2,0]);     // Marks and Numbers
                end
                else if sSegmentID = 'SPO' then begin
                   ListBox1.Items.Add(oSegment.DataElement[1].Description + ' = ' + oSegment.DataElementValue[1,0]);     // Purchase Order Number
                   sValue := oSegment.DataElementValue[2,0];     // Reference Identification
                   sValue := oSegment.DataElementValue[3,0];     // Unit or Basis for Measurement Code
                   ListBox1.Items.Add(oSegment.DataElement[4].Description + ' = ' + oSegment.DataElementValue[4,0]);     // Quantity
                end;   //sSegmentID
             end;   //sLoopID
          end;  //nArea
 
          // GETS THE NEXT DATA SEGMENT
          oSegment := oSegment.Next as IediDataSegment;
       end;

       ShowMessage('Done');

    end;
    

    Click here to download a trial version of the Framework EDI