How get the invalid character?

I've got the event
Event Type: Error
Event Source: BizTalk Server 2006 EDI
Event Category: None
Event ID: 8118
...
Description:
Error encountered during parsing. The Edifact transaction set with id '00000000000894' contained in interchange (without group) with id '00000000000817', with sender id 'APLUPROD', receiver id '6046666086' is being suspended with following errors:
Error: 1 (Field level error)
SegmentID: NAD
Position in TS: 4173
Data Element ID: C05801
Position in Segment: 4
Position in Field: 1
Data Value:
6: Invalid character in data element
I don't know how can I find this character.
1) "Position in TS" means "Position in Transaction Set, right? Where? 4173th segment? From UNB? From UNH? I know this is not a character position. If this is a segment position, how I can find it (do you have a RegEx for this? or I have to scan all NADs and guess is it the erroneous one (Yeah, this my methodSmile )
2) Seems this is a unprintable character? Is it possible to output it in 0x... format?
OK
Sometimes I've got say
" Data Value: BIG "C" FREIGHT FORWARDER CANADA IN
21: Invalid character found
"
Here the invalid character is ["], printable. But could someone say that without testing? ( 1.There are 2 ["], the text is only about one character. 2.Where can I see the wrong character? "21" - this is not a position!)
Regards,
Leonid Ganeline
http://geekswithblogs.net/leonidganeline/

[2043 byte] By [LeonidGaneline] at [2008-2-15]
# 1

1. You are right. TS means Transaction Set. And it is the 4173 segment from the first segment (UNH is segment 1 and so on). There are no regular expression to find this expression. However there are a few work arounds. If the file has CR, LF or CRLF, you can open this file in excel or Visual Studio, and go to line 4173. For a file with no segment suffix, you would have to scan all NAD's. Another workaround could be to write a light weight parser that increments the counter everytime you hit the segment terminator stopping at the required line etc.

2. Not currently, but this is a good suggestion, and we will track it for future versions.

3. For every field level error, you get the position in TS, position in segment and the position in field so you can pinpoint the exact location. Fields with no component will always have a position in field set to 1. "21" is the error code.

Hope this helps

Mohsin

MohsinKalam–MSFT at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 2
Mohsin, thanks for quick answer!
Seems that "Position in Field" doesn't work:
Error: 1 (Field level error)
SegmentID: NAD
Position in TS: 2510
Data Element ID: C05802
Position in Segment: 4
Position in Field: 2
Data Value: 100% EOU
21: Invalid character found
Error: 2 (Field level error)
SegmentID: NAD
Position in TS: 4925
Data Element ID: C05803
Position in Segment: 4
Position in Field: 3
Data Value: WINNIPEG MANITOBA R3H 0L9 ***
21: Invalid character found
In first error the position = 2, but "100% EOU" has the wrong char '%' in 4th [1..] or 3th [0..] position.
In second error the position = 3, but "WINNIPEG MANITOBA R3H 0L9 ***" has the wrong chars "***" in ... maybe 5th or 6th position Smile but not the 3th.
Regards,
Leonid Ganeline
http://geekswithblogs.net/leonidganeline/
LeonidGaneline at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 3

Position in field refers to the position in component field. So if a field is sub divided in components, the first component will have position in field = 1, second one will have it as 2 and so on. A data element field (field with no components) will always have a position in field as 1. So from error 1, it looks like the Data Element ID C05802 is a component field, and the "100% EOU" is the second component of that field. Same logic applies to error 2.

Can you confirm if thats the case in your schema?

Thanks

Mohsin

MohsinKalam–MSFT at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 4
Thanks, Mohsin!
Yes C05802 is a second part of C058 component field.
Intuitively I tried to find the character position (The whole error is about character, not about a field, isn't it?)
If it is possible I'd prefer to see not:
Error: 2 (Field level error)
SegmentID: NAD
Position in TS: 4925
Data Element ID: C05803
Position in Segment: 4
Position in Field: 3
Data Value: WINNIPEG MANITOBA R3H 0L9 ***
21: Invalid character found
- but something like:
Error: 2 (Field level error)
Character position in Source file: 56789
Segment ID: NAD
Segment position in Transaction Set: 4925
Data Subelement ID: C05803
Element position in Segment: 4
Subelement position in Element : 3
Data Value: "WINNIPEG MANITOBA R3H 0L9 ***"
Character position in Subelement : 27
Invalid character(s) found: '*'
Regards,
Leonid Ganeline
http://geekswithblogs.net/leonidganeline/
LeonidGaneline at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...