Sun B2B Suite HIPAA OTD Library User's Guide

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 “com.stc.x12env.runtime.ic.ICEnv” 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
    com.stc.x12env.runtime.ic.ICEnv icEnvOtd = new com.stc.x12env.runtime.ic.ICEnv();

    // (2) Set delimiters in the Interchange Envelope OTD
    icEnvOtd.setSegmentTerminator(’~’);
    icEnvOtd.setElementSeparator(’+’);
    icEnvOtd.setSubelementSeparator(’^’);

    // (3) Create a new ISA segment object
    com.stc.x12env.runtime.ic.ISA isaSegment = new com.stc.x12env.runtime.ic.ISA();

    // (4) Populate the fields inside the ISA
    isaSegment.setEI01_1_AuthInfoQual("00");
    isaSegment.setEI02_2_AuthInfo("          ");
    isaSegment.setEI03_3_SecuInfoQual("01");
    isaSegment.setEI04_4_SecuInfo("          ");
    isaSegment.setEI05_5_InteIDQual("13");
    isaSegment.setEI06_6_InteSendID("3105451234");
    isaSegment.setEI05_7_InteIDQual("16");
    isaSegment.setEI07_8_InteReceID("123456789");
    com.stc.runtime.dt.Date date = com.stc.otd.runtime.edi.EdiDate.parse8("20070115");
    isaSegment.setEI08_9_InteDate(date);
    com.stc.runtime.dt.Time time = com.stc.otd.runtime.edi.EdiTime.parse4("1647");
    isaSegment.setEI09_10_InteTime(time);
    isaSegment.setEI10_11_InteContStanIden("U");
    isaSegment.setEI11_12_InteContVersNumb("00301");
    isaSegment.setEI12_13_InteContNumb(905);
    isaSegment.setEI14_15_UsagIndi("T");
    isaSegment.setEI13_14_AcknRequ("1");
    isaSegment.setEI15_16_CompElemSepa(":");

    // (5) Set the rest of delimiters inside the ISA segment object
    isaSegment.setSegmentTerminator(’!’);
    isaSegment.setElementSeparator(’*’);

    // (6) Set the populated ISA segment object to the Interchange    
    //     Envelope OTD
    icEnvOtd.setISA_InteContHead(isaSegment);

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

    // (8) Populate the fields inside the IEA
    ieaSegment.setEI12_2_InteContNumb(905);
    ieaSegment.setEI16_1_NumbOfInclFuncGrou(1);

    // (9) Provide the Functional Group data
    String funcGrp = " GS*FA*123*321*927003*1203*1112*T*004010!ST*997*0001!AK1*FA*1!
    AK2*997*0001!AK3*BEG*31**1!AK4*12:4*479*1*98382LKA!AK5*A*1*3*5*1*3!
    AK9*A*0*433*500006*1*2*5*1*2!SE*8*0001!GE*1*1112!";

    // (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
*051215*1647*U*00301*000000905*1*T*:!
 GS*FA*123*321*927003*1203*1112*T*004010!ST*997*0001!AK1*FA*1!AK2*9
97*0001!AK3*BEG*31**1!AK4*12:4*479*1*98382LKA!AK5*A*1*3*5*1*3!AK9*
A*0*433*500006*1*2*5*1*2!SE*8*0001!GE*1*1112!IEA*1*000000905!