In an ANSI X12 EDI Message, we have Data element separator, Component Element Separator and Segment Terminator in the ISA segment.
D_DATAELEMENTSEPARATOR (Data Element Separator) is at 1st position in the ISA segment which is used to determine the delimiter in between the elements of one segment across the EDI Document. This is an optional element whose default value is ASCII character (*) hexadecimal value '2A'.
D_I15 (Component Element Separator) is at 16th position in the ISA segment which is used to determine the end of ISA (interchange start).
D_SEGMENTTERMINATOR (Segment Terminator) is at 17th(last) position in the ISA segment which is used to determine the delimiter in between the segments of across the EDI Document. This is an optional element whose default value is ASCII (LF) Line Feed (\n) hexadecimal value '0A'.
Handling these separators:
Issue 1– Failed in component - Module exception (x12 converter exception)
Reasons–
1) If any of the separators are of length more than one (1)
2) If DataElementSeparator or SegmentTerminator are alphanumeric
Analysis–
1) Numbers (0,1,2...), letters (A, B...), combination (A1,1B...) are not accepted
2) Escape sequences /n, /r,... etc. are directly passed (hard-coded in mapping) - this is treated as length (>1) and alphanumeric
3) Only special characters of length = 1 are acceptable eg. |,*,^,\,{,},/.....
ASCII characters–
(printable ASCIIcharacters e.g. 0x85, 0x0A,0x0D,0x5E,0x7B- see attached for list of printable ASCII characters and extended ASCII)
UDF returning the ASCII characters based on hex values can be used to map these separators
0x0a separator (new line) - Segment Terminator is an optional field (default value is 0A (/n)); every segment is separated by a linefeed when this field is not mapped)
Issue 2– String Index out of range (x12 converter exception)
Reason–
If DataElementSeparator or SegmentTerminator have ASCII characters whose hexadecimal values are of length more than 3
Case– Up tack symbol (┴) (hex value -22a5)
Analysis–ASCII characters whose hex values are out of range
Possible values ( ASCII printable chars (..62,63,..), escape chars (..0A, 85, 0E..), Extended ASCII (...128,..136..)
Values such as up tack (┴) with hex value -22a5 are not acceptable as element or segment separator in an EDI file
(see attached ASCII table)
Case– Control characters as segment separator in an inbound EDI file
Some partners generate EDI files with control characters as segment separators (e.g. NAK - Negative Acknowledgement , hex (15))
Ideally, Unicode control characters are not allowed in XML representation
This is taken care at conversion level (X12 converter module takes care of removing Invalid XML character)
And the optional segment terminator is treated internally as default New line (hex 0A)
Summary:
Element | Description | Position in ISA | Occurrence | Length | Default Value | Limitation |
D_DATAELEMENTSEPARATOR | Data Element Separator | 1 | Optional | 1 | * | Only special(escape) characters whose hex value is in range |
D_I15 | Component Element Separator | 16 | Mandatory | 1 | - | Any character (length restriction (1)) |
D_SEGMENTTERMINATOR | Segment Terminator | 17 | Optional | 1 | New Line | Only special(escape) characters whose hex value is in range |
Attachment - ASCII table