This project has moved and is read-only. For the latest updates, please go here.

Issue with unbundling 837 files

Aug 27, 2012 at 2:58 PM


I get the following error when trying to  unbundle certain 837 files:

Unhandled Exception: OopFactory.X12.Parsing.Model.TransactionValidationException: Transaction control number 8990 for transaction code 837 already exist within the functional group 1.Parameter name: 837   at OopFactory.X12.Parsing.Model.FunctionGroup.AddTransaction(String segmentString)
   at OopFactory.X12.Parsing.X12Parser.Parse(Stream stream)   at OopFactory.X12.X12Parser.Program.Main(String[] args)

Not all files fail with the same transaction control number.

Any idea what could be wrong with the raw data?

Your help would be greatly appreciated.

Thanks in advance for your help. 

Aug 27, 2012 at 3:42 PM

Within each Functional Group which starts with an GS* segment and ends with a GE* segment, each transaction is expected to have a unique control number.

Transactions start with an ST* segment and end with an SE* segment.

You can probably search your raw file for ST*837*8990 and it will appear more than once in your file.

Aug 27, 2012 at 3:45 PM

Btw, if you can't control that your data will have duplicates like this you can use the X12StreamReader to get one transaction at a time and then send it to the UnbundleByLoopId method.  This was added in the last release so that the entire file would not have to be loaded to start parsing it.  See the ParseX12 console app for a usage example.

Aug 27, 2012 at 5:07 PM

Dear dstrubhar, thank you so much for your timely help.  I will try that now.

Also, your valuable help is always greatly appreciated. I maintain what I have said before - The X12Parser is a real blessing to us developers.

Kind Regards. 

Aug 31, 2012 at 11:43 PM

Dear Sir,

I referred to the ParserX12 console app for a usage example on how to use X12StreamReader to get 1 transaction at a time. However, the UnbundleByLoopId method in the new version continues to accept only an Interchange object as the first argument. How do I pass the Transaction object instead? Also, the Unbundle in the previous version retains the header information, which is really great. Using X12StreamReader and hence an individual Transaction now, can we retain the header information as well? I would really appreciate if you could please provide an example of using the Unbundle feature with X12StreamReader so I can work around the duplicate transaction control number issue.

Many thanks, in advance.

Kind Regards.

Sep 2, 2012 at 5:06 PM

I have changed to UnbundleX12 console app to use the X12StreamReader on all transactions, so that others will also be able to bypass this problem.  See Changeset 19582.

This will also avoid having out of memory exceptions on large files.

BTW, when you call ToString on the object returned from GetNextTransaction, this is what will add the ISA and GS segments back onto the transaction so that you can work with it as a self contained X12 string.

Sep 5, 2012 at 2:15 AM

Dear Sir,

THANK YOU SO MUCH for providing me with a code sample for the Unbundle feature using transactions. The latest API and these new features work like a charm. My issue with duplicate transaction control numbers is resolved, all thanks to you. 

I am really very much appreciative of all your help, especially for providing the sample over a holiday weekend. 

Kind Regards.