2
votes

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


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
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
Segment is the tilde. - Andrew
smooks will not read the ISA segment, if i configure segment="&#126;" - JToddler
Try this. I don't know smooks so it probably won't work. <medi:delimiters segment="~" field="*" component=":" sub-component=">" escape="?" /> - Andrew

1 Answers

4
votes

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.