2

i'm able to read the EDI file using Smooks (1.5) when it is formatted for readablity

ISA*SD*          *DFDF*          *SDFDSF*FHGFH       *44*GHGHGHG       *GHGH*GHGHGH*^*GHGHG*46345345*B*4*:~ 
GS*SS*2323*23232*232323*32323*1*X*FDFGDFGDF~
GE*YTRY*DF~ 
IEA*DF*DGHJGHHGG~

To read this, i used the below configurations

<medi:delimiters segment="&#10;" field="*" 
    component="^" sub-component="~" escape="?" />

But it failed, when i tried to read the below EDI (unformatted EDI) segments with same delimiter configuration

ISA*SD*          *DFDF*          *SDFDSF*FHGFH       *44*GHGHGHG       *GHGH*GHGHGH*^*GHGHG*46345345*B*4*:~GS*SS*2323*23232*232323*32323*1*X*FDFGDFGDF~GE*YTRY*DF~IEA*DF*DGHJGHHGG~

here the problem is, all the segment codes are in same line. i know the reason why its failing to read EDI segments.it's failing because of the configuration segment="&#10". Is it possible to read these types of EDI message. or is this unrealistic EDI message ? i believe Carriage return and line feed are not required characters by EDI X12 standard.i want to know how to read this unformatted EDI and how to configure the delimiter for this unformatted EDI


Dan Field
  • 20,885
  • 5
  • 55
  • 71
JToddler
  • 790
  • 1
  • 6
  • 16
  • 1
    The segment terminator is clearly the tilde (~). The component separator is the colon. Download EDI Notepad from Liaison so you can tell what you're looking at. – Andrew Mar 03 '16 at 20:13
  • i checked these edi message in EDI notepad.i can see the delimiters [segment terminator(~), element separator(*), subelement separator(:) and repeat character]. my question is, what character i can use for configuring delimiter segment code for smooks to read these types of EDI message ? – JToddler Mar 04 '16 at 17:45
  • Segment is the tilde. – Andrew Mar 04 '16 at 18:22
  • smooks will not read the ISA segment, if i configure segment="~" – JToddler Mar 04 '16 at 18:41
  • Try this. I don't know smooks so it probably won't work. – Andrew Mar 04 '16 at 19:21
  • ~ is equivalent of ~. it wont read ISA segment. but it can read rest of the segment. – JToddler Mar 04 '16 at 19:53

1 Answers1

5

Your ISA segment is invalid:

  • ISA03 has a value of "DFDF", but should not be longer than 2 chars
  • ISA05 has a value of "SDFDSF", but should be no longer than 2 chars
  • ISA06 has a value of "FHGFH ", which is 12 chars long but should be 15 (including whitespacE).
  • ISA08 and ISA13 are also one character too short

This throws the whole segment off, which from the "I" to the segment terminator should be exactly 106 characters (not including an optional trailing \r\n), but you end up with 108 (again, not including a carriage return or line feed). The ISA segment is the only one that has these restrictions - if it's off, the parser won't know how to possibly parse the rest of the file. I suspect you edited your ISA to try to anonymize it, but you almost certainly have the same problems (or some of them) with your acutal ISA - check what the 106th char is, and you'll find it's a \r (or ASCII 10), which is why Smooks is taking it as your segment terminator.

Dan Field
  • 20,885
  • 5
  • 55
  • 71
  • Exactly what Dan says. You shouldn't have to define delimiters in your parser because those are defined in the ISA segment. The only way that works is if the ISA segment uses fixed width fields so you have to get them right. – Mufaka Mar 24 '16 at 19:08