KB Article #178438

[EDI - 0]: EDI_RW: Failed to read segment tag. Document position = HEADER/UNG

Problem

-- getting such parsing error when trying to parse a message ODETTE V3_1 / document DELINS

[EDI - 0]: EDI_RW: Failed to read segment tag. Document position = HEADER/UNG. Segment counter = 1 - INPUT_ERROR_POSITION=73;
[EDI - 0]: EDI_RW: Missing mandatory segment Document position = UNZ. Segment counter = 1 - INPUT_ERROR_POSITION=67;
EDI error attribute created: {{18,1,"UNG",0,"",0,"","","Failed to read segment tag. Document position = HEADER/UNG. Segment counter = 1","EDIFACT","

{\\\"3\\\"}"},{13,1,"UNZ",0,"",0,"","","Missing mandatory segment.","EDIFACT","{\"3\"}

"}}

-- the error refers to the UNG (functionnal group) which is optionnal and not present in the message


Resolution

* the segments of the input file are on separate lines
* parser throws the error at UNG level since that is the first segment that is checked (even if it's optional). The UNB is parsed correctly since "CR LF" is at the end of that line in the file. Then it tries to parse for a new segment, starts to match with "UNG" since it's the next in line. The segment tag resulted is "\r\nUNH" which is 5 chars. Then it throws the error as the length of this tag is illegal
* for testing all segments should to be put into single line