Sun B2B Suite HIPAA OTD Library User's Guide

ISA Segment Parsing

The ISA segment in a HIPAA message is of fixed length, and has sixteen fixed-length data fields. The fixed-length property of the ISA segment enables you to define the fixed positions for delimiters, such as segment terminator and element separator, that are critical for parsing the HIPAA message. Logic has been built into the fully-enveloped OTDs, including the HIPAA Interchange Envelope OTD to retrieve the delimiters at certain fixed positions and use these delimiters to unmarshal the message.

However, if any of the sixteen data fields is longer or shorter than defined in the specification, the positions of delimiters are nonstandard. This error will result in parsing difficulties and probable runtime failure. In some cases, data that is specified incorrectly in this way can cause conflicting delimiter values, such as element separator defined the same as segment terminator, rendering the whole message unparsable.

Steps Taken to Check for ISA Segment Errors

Assuming valid data, the logic for checking ISA segment errors is as follows:

  1. Check whether the character at index=3 is a valid element separator. If not, an UnmarshalException is thrown, and the unmarshaling process is terminated.

  2. Check whether the characters at index=6,17,20,31,34,50,53,69,76,81,83,89,99,101,103 is same as that at index=3. If not, an UnmarshalException is thrown with an error message that begins "ISA Segment Error", and processing continues with variable length parsing.

  3. Check whether the character at index=104 is a valid subelement separator. If not, an UnmarshalException is thrown with an error message that begins "ISA Segment Error", and processing continues with variable-length parsing.

  4. Check whether the character at index=105 is a valid segment terminator, and also verify that this character is different from the element separator and subelement separator. If not, an UnmarshalException is thrown with an error message that begins "ISA Segment Error", and processing continues with variable-length parsing.

  5. If the version of X12 is version 4020 or later, check whether the character at index=82 is a valid repetition separator and different from the element separator, subelement separator, and segment terminator. If not, an UnmarshalException is thrown with an error message that begins "ISA Segment Error", and processing continues with variable-length parsing.

  6. If variable-length parsing becomes necessary, the ISA segment is parsed using the element separator to retrieve the next sixteeen data elements. After this ISA parsing, an UnmarshalException is thrown with an error message that begins "ISA Segment Error", and the OTD with ISA segment parsed may be examined later to retrieve the parsed ISA segment.

If the message does not have a terminator for its last segment , the ISA segment is also parsed before an UnmarshalException is thrown. You can catch this UnmarshalException and examine the parsed ISA segment in the OTD, for example, to generate negative TA1 acknowledgment.