EDI File Splitter

Is that large EDI file causing you problems? Just split it!

“The libraries are proving to be invaluable to our project”

EDIFileSplitter provides a fast and easy way to split large EDI files into smaller ones quickly and efficiently.  It exhibits fast reading and writing speeds and offers the ability to split EDI files at the Functional Group Level (GS) or the Header Level (ST).


Main Features

  • Ability to split multiple X12 EDI files into many EDI files
  • Ability to split X12 files at the functional group level (GS) or the header level (ST)
  • Ability to specify how many headers or functional groups to place in each split file
  • Auto placement of # of segments, # of transactions and # of functional groups in the SE, GE and IEA segments
  • Fast reading and writing speeds
  • Asynchronous file read and write operations
  • Buffered write operations to decrease IO calls
  • Memory efficient
  • Ability to specify the size of read and write buffers for less IO operations
  • Easy to use API


It may be more efficient to process smaller EDI files than one large file in some circumstances.  For example, with multiple EDI files multi-threaded techniques can be employed to speed up overall load time. Some system also work faster with smaller files.  EDIFileSplitter can split large EDI files into smaller ones.  It’s a high-speed multi-threaded splitter that can split on a message level or functional group level.  The number of (GS) functional groups or (ST) header that each file can contain is configurable.  Memory usage is transient and does not depend on how much RAM is available.  Because input and output buffer sizes can be customized there are less IO calls and overall performance is increased.

Files can also be split in asynchronous mode.  An event is then thrown when the split operation is complete.  Output file names and extensions are customizable.  The current date can be appended to the name of each generated file.  The date string is guaranteed to be unique.

Auto Placement of Number of Segments, Transactions and Functional Headers

SE segments must contain the total amount of segments used within that specific header.  EDIFileSplitter will automatically keep a count of the number of segments used in the header and goes as far as to actually enter that data in the SE segment.  Additionally the number of ST transactions and GS Functional Groups are also tracked and added to the GE and IEA segments


EDIFileSplitter ediFileSplitter = new EDIFileSplitter();

// Split the file at the header level (ST segment)
ediFileSplitter.FileSplitLevel = FileSplitLevel.HEADER;

// Place 2 ST headers per file
ediFileSplitter.NumberOfItemsPerFile = 2;
ediFileSplitter.OnFileOperationCompleted += new EventHandler(splitter_OnFileOperationCompleted);

   string currentDirectory = Directory.GetCurrentDirectory();
   ediFileSplitter.Split("837P_2ST_SE_Loops.txt", currentDirectory);
catch (Exception ex)

private void splitter_OnFileOperationCompleted(object sender, FileOperationCompletedEventArgs e)
    if (e.Status != FileOperationStatus.Success)
       MessageBox.Show("Error splitting file", "Error");
    else if (e.Status == FileOperationStatus.Success)
       MessageBox.Show("File Split Success", "Success");

Example Usage

You may need to split an EDI  file in multiple files for a variety of reasons.  EDIFileSplitter can help you accomplish this quickly and efficiently.

The following EDI file is an X12 837P EDI file that contains 2 ST headers.  This file can be split easily into two files with 1 ST header each.

Original EDI File

After using the EDIFileSplitter component the following two files are created:



There are now two separate files.  In this quick example we split the original file on the header with one ST header per file.  With EDIFileSplitter we can also split on the Functional Header (GS) as well. We can also specify how many ST headers or GS headers should go in each file.


The EDIFileSplitter component is included in RDPCrystal EDI Library