Sun B2B Suite HIPAA OTD Library User's Guide

Setting Delimiters

The OTDs must include some way for delimiters to be defined so that they can be mapped successfully from one OTD to another. The HIPAA delimiters are as follows:

The repetition separator and subelement separator are explicitly specified in the interchange header segment. The other two delimiters are implicitly defined within the structure of the interchange header segment, by their first use. For example, after the fourth character defines the data element separator, the same character is used subsequently to delimit all data elements; and after the 107th character defines the segment terminator, the same character is used subsequently to delimit all segments.

Incoming Message

Because the fully-enveloped OTD automatically detects delimiters in an incoming message that has the interchange header segment while unmarshaling, do not specify delimiters for the incoming message. Any delimiters that are set before unmarshaling are ignored, and the unmarshal() method picks up the delimiter used in the ISA segment of the incoming message.

For non-enveloped OTDs, if the incoming message uses non-standard delimiters, set the delimiters on the OTD instance before the unmarshal() method is invoked.

Setting Delimiters

You can set the delimiters in the Java Collaboration Editor using the methods or bean nodes that are provided in the OTDs. Use the following methods to specify delimiters:

If the input data is already in HIPAA format, you can use the get methods to retrieve the delimiters from the input data. For information, refer to Get and Set Methods.

Outgoing Message

If an OTD outputs ANSI X12 data rather than XML, you must specify the delimiters only if non-standard delimiters are used. If the delimiters are not specified, the industry standard delimiters are used. (For information about which methods to use for delimiter setting, refer to Setting Delimiters)

Note that the interchange-level object is called a fully-enveloped OTD; the message-level object is called a non-enveloped OTD.

For fully-enveloped OTDs, you can also set the subelement separator and repetition separator from the corresponding elements within the ISA segment.

To add the support of serialization i.e. marshalling of non-root level objects such as segments, composites, and segment loops in addition to root level objects i.e. interchange level objects, group level objects and message level objects; each of the non-root level objects now contains a set of delimiters appropriate to its message type which are accessible through a few methods/APIs mentioned below to the user.

Delimiter Set

The delimiter set for the HIPAA message type consists of the following:

Accessor Methods

The methods to access the delimiters inside a root-level or non-root-level object are:

Initialization of the Delimiter Set

The delimiters of a root-level or non-root-level object are defaulted to their industry standard values when the delimiter set is created. Each individual delimiter can be changed by the corresponding setter method during initialization or later invocation by the user.

The initialization of the delimiter set can be triggered either by any of the Accessor Methods, or by any the following additional methods:

Precedence of Delimiters

When a fully-enveloped OTD or interchange envelope OTD is used to marshal its content into an outgoing message, the delimiter values in the first delimiter field-containing segment (the ISA segment) can sometimes conflict with the delimiter values specified at the interchange level (that is, at the OTD level). This occurs because the interchange level objects and non-root-level objects can separately allow a user to set delimiters independently in a fully-enveloped OTD.

The delimiter values in the ISA segment, if initialized, take precedence over the delimiter values set for the fully-enveloped OTD or interchange envelope OTD. The precedence order can therefore be represented as follows:

Delimiter set in the ISA segment (if initialized) > Delimiter set in the OTD

Example Showing Delimiter Precedence

The following example method illustrates the precedence of delimiters set in the X12 ISA segment over delimiters set in the root level “” object in an X12 interchange envelope OTD:

public String generateOutput() throws Exception {

     String encoding = "utf-8";

    // (1) Create a new instance of X12 Interchange Envelope OTD icEnvOtd = new;

    // (2) Set delimiters in the Interchange Envelope OTD

    // (3) Create a new ISA segment object isaSegment = new;

    // (4) Populate the fields inside the ISA
    isaSegment.setEI02_2_AuthInfo("          ");
    isaSegment.setEI04_4_SecuInfo("          ");
    isaSegment.setEI07_8_InteReceID("123456789"); date ="20070115");
    isaSegment.setEI08_9_InteDate(date); time ="1647");

    // (5) Set the rest of delimiters inside the ISA segment object

    // (6) Set the populated ISA segment object to the Interchange    
    //     Envelope OTD

    // (7) Get the IEA segment object inside the Interchange
    //     Envelope OTD; also creates the IEA segment instance ieaSegment = icEnvOtd.getIEA_InteContTrai();

    // (8) Populate the fields inside the IEA

    // (9) Provide the Functional Group data
    String funcGrp = " GS*FA*123*321*927003*1203*1112*T*004010!ST*997*0001!AK1*FA*1!

    // (10) Set the functional group data inside the Interchange    
    //      Envelope OTD
     icEnvOtd.setFunctionalGroup(0, funcGrp.getBytes(encoding));

    // (11) Invoke API to generate serialized byte array output
    //      of the Interchange Envelope OTD
    byte[] results = icEnvOtd.marshalToBytes();

    // (12) return as a string
    return new String(results, encoding);


The foregoing example method returns the following string as output:

ISA*00*          *01*          *13*3105451234     *16*123456789