EDI File Splitter
Main Features
- Split large EDI files into smaller, more manageable ones
- Split files at the Envelope (ISA), Functional Group (GS), or Transaction (ST) level
- Specify how many Functional Groups or Transactions should go in each file
- Customizable output filenames and extensions
- Auto placement of segment, transaction and functional group counts in the SE, GE and IEA segments
- Supports any X12 standard
Details
It may be more efficient to process smaller EDI files than a large one in some circumstances. For example, with multiple files multi-threaded techniques can be employed to speed up overall load time. Some systems work faster with smaller files. EDIFileSplitter is a high-speed multi-threaded splitter that can split on a Interchange (ISA), Functional Group (GS) or Transaction (ST) level. The number of functional groups or transactions per file 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
The Code
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);
try
{
string currentDirectory = Directory.GetCurrentDirectory();
ediFileSplitter.Split("837P_2ST_SE_Loops.txt", currentDirectory);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
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 with file
You may need to split a EDI file into 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.
ISA*00* *00* *ZZ*SMITH *ZZ*BCBSGA *07011A*1350*U*00401*000000011*1*P*>~
GS*HC*SMITH*BCBSGA*20070118*1350*11*Y*004010X098A1~
ST*837*000000001~
BHT*0019*00*00000*20070118*1350*CH~
REF*87*004010X098A1~
NM1*41*2*ABC LABORATORY*****46*SMITH~
PER*IC*JANE DOE*TQ*2127351234~
NM1*40*2*A COMPANY*****46*00601~
HL*1**20*1~
NM1*85*2*ABC LABORATORY*****24*123456789~
N3*112 ROAD WAY~
HL*2*1*22*0~
SBR*P*18*******CI~
NM1*IL*1*SMITH*TEST****MI*505XXXX~
N4*SPRINGFIELD*NY*11111~
DMG*D8*19950101*F~
NM1*PR*2*AMERIGROUP/MDGA MANAGED CARE*****PI*XX123A~
N4*SOUTH BEACH*FL*23466~
CLM*1-1178*126.84***81>>1*Y*A*Y*Y*B*AA>>>>>>REF*EW*004010X098A1~
HI*BK>5990~
LX*1~
SV1*HC>87086*31.96*UN*1***1~
DTP*472*D8*20070118~
SE*227*000000001~
ST*837*000000001~
BHT*0019*00*00000*20070118*1350*CH~
REF*87*004010X098A1~
NM1*41*2*ABC LABORATORY*****46*SMITH~
PER*IC*JANE DOE*TQ*2127351234~
NM1*40*2*A COMPANY*****46*00601~
HL*1**20*1~
NM1*85*2*ABC LABORATORY*****24*123456789~
N3*112 ROAD WAY~
HL*2*1*22*0~
SBR*P*18*******CI~
NM1*IL*1*SMITH*TEST****MI*505XXXX~
N4*SPRINGFIELD*NY*11111~
DMG*D8*19950101*F~
NM1*PR*2*AMERIGROUP/MDGA MANAGED CARE*****PI*XX123A~
N4*SOUTH BEACH*FL*23466~
CLM*1-1178*126.84***81>>1*Y*A*Y*Y*B*AA>>>>>>REF*EW*004010X098A1~
HI*BK>5990~
LX*1~
SV1*HC>87086*31.96*UN*1***1~
DTP*472*D8*20070118~
SE*227*000000001~
GE*1*11~
IEA*1*000000011~
After using the EDIFileSplitter component the following two files are created:
ISA*00* *00* *ZZ*SMITH *ZZ*BCBSGA *07011A*1350*U*00401*000000011*1*P*>~
GS*HC*SMITH*BCBSGA*20070118*1350*11*Y*004010X098A1~
ST*837*000000001~
BHT*0019*00*00000*20070118*1350*CH~
REF*87*004010X098A1~
NM1*41*2*ABC LABORATORY*****46*SMITH~
PER*IC*JANE DOE*TQ*2127351234~
NM1*40*2*A COMPANY*****46*00601~
HL*1**20*1~
NM1*85*2*ABC LABORATORY*****24*123456789~
N3*112 ROAD WAY~
HL*2*1*22*0~
SBR*P*18*******CI~
NM1*IL*1*SMITH*TEST****MI*505XXXX~
N4*SPRINGFIELD*NY*11111~
DMG*D8*19950101*F~
NM1*PR*2*AMERIGROUP/MDGA MANAGED CARE*****PI*XX123A~
N4*SOUTH BEACH*FL*23466~
CLM*1-1178*126.84***81>>1*Y*A*Y*Y*B*AA>>>>>>REF*EW*004010X098A1~
HI*BK>5990~
LX*1~
SV1*HC>87086*31.96*UN*1***1~
DTP*472*D8*20070118~
SE*227*000000001~
GE*1*11~
IEA*1*000000011~
ISA*00* *00* *ZZ*SMITH *ZZ*BCBSGA *07011A*1350*U*00401*000000011*1*P*>~
GS*HC*SMITH*BCBSGA*20070118*1350*11*Y*004010X098A1~
ST*837*000000001~
BHT*0019*00*00000*20070118*1350*CH~
REF*87*004010X098A1~
NM1*41*2*ABC LABORATORY*****46*SMITH~
PER*IC*JANE DOE*TQ*2127351234~
NM1*40*2*A COMPANY*****46*00601~
HL*1**20*1~
NM1*85*2*ABC LABORATORY*****24*123456789~
N3*112 ROAD WAY~
HL*2*1*22*0~
SBR*P*18*******CI~
NM1*IL*1*SMITH*TEST****MI*505XXXX~
N4*SPRINGFIELD*NY*11111~
DMG*D8*19950101*F~
NM1*PR*2*AMERIGROUP/MDGA MANAGED CARE*****PI*XX1D23A~
N4*SOUTH BEACH*FL*23466~
CLM*1-1178*126.84***81>>1*Y*A*Y*Y*B*AA>>>>>>REF*EW*004010X098A1~
HI*BK>5990~
LX*1~
SV1*HC>87086*31.96*UN*1***1~
DTP*472*D8*20070118~
SE*227*000000001~
GE*1*11~
IEA*1*000000011~