staedi icon indicating copy to clipboard operation
staedi copied to clipboard

Improper parse of simple 837

Open cpotter1 opened this issue 1 year ago • 5 comments

Consider this simple x12:

ISA*01*0000000000*01*0000000000*ZZ*ABCDEFGHIJKLMNO*ZZ*123456789012345*101127*1719*`*00402*000003438*0*P*>
  GS*HC*99999999999*888888888888*20111219*1340*1377*X*005010X222
    ST*837*0001*005010X222
    SE*39*0001
  GE*1*1377
IEA*1*000003438

The stream of events I see is as follows:

event: START_INTERCHANGE at offset 106
event: START_SEGMENT in segment ISA at position 1
event: END_SEGMENT after segment ISA at position 1
event: START_GROUP in segment GS at position 2
event: START_SEGMENT in segment GS at position 2
event: END_SEGMENT after segment GS at position 2
event: START_TRANSACTION in segment ST at position 3
event: START_SEGMENT in segment ST at position 3
event: END_SEGMENT after segment ST at position 3
event: START_SEGMENT in segment SE at position 4
event: ELEMENT_DATA_ERROR in segment SE at position 4, element 1
event: ELEMENT_DATA_ERROR in segment SE at position 4, element 1
event: END_SEGMENT after segment SE at position 4
event: END_TRANSACTION in segment GE at position 5
event: START_SEGMENT in segment GE at position 5
event: END_SEGMENT after segment GE at position 5
event: END_GROUP in segment IEA at position 6
event: START_SEGMENT in segment IEA at position 6
event: END_SEGMENT after segment IEA at position 6
event: END_INTERCHANGE after segment IEA at position 6

There are a few concerns I have with this:

  1. I don't see a START_TRANSACTION/.../END_TRANSACTION for SE
  2. (Perhaps the above is related to ELEMENT_DATA_ERROR - but this doesn't seem like it should be a problem.
  3. I don't see a START_GROUP/...END_GROUP for GE

Please have a look.

Thanks!

cpotter1 avatar Jun 30 '24 12:06 cpotter1

Hi @cpotter1 , the "END" events are currently signaled at the start of the following segment but the "START" events do provide the starting segment name in the position information.

E.g.

  • event: START_GROUP in segment GS at position 2
  • event: START_TRANSACTION in segment ST at position 3

I understand the confusion around the end event, but are you expecting something else for the start events?

MikeEdgar avatar Jul 01 '24 16:07 MikeEdgar

There are two transactions here - ST and SE. Where are the SE transaction events? That is my question #1.

cpotter1 avatar Jul 01 '24 17:07 cpotter1

ST is the start of a transaction, SE is the end. One transaction per ST/SE pair.

MikeEdgar avatar Jul 01 '24 18:07 MikeEdgar

Ok, so you see it part of the txn itself. Ok.

What about point 2 re: ELEMENT_DATA_ERROR ?

cpotter1 avatar Jul 02 '24 14:07 cpotter1

What about point 2 re: ELEMENT_DATA_ERROR ?

For this particular example, I suspect the reason for one of the errors was CONTROL_COUNT_DOES_NOT_MATCH_ACTUAL_COUNT. The count in SE01 it validated to be the number of segments in the transaction (including ST and SE), which in this case is 2. You can fetch the error type via EDIStreamReader#getErrorType() when the ELEMENT_DATA_ERROR occurs.

MikeEdgar avatar Jul 02 '24 15:07 MikeEdgar

@cpotter1 any update on this issue?

MikeEdgar avatar Aug 14 '24 11:08 MikeEdgar

Closing due to lack of feedback. Please re-open if it's still an issue and more information is available.

MikeEdgar avatar Oct 16 '24 11:10 MikeEdgar