Skip to main content

Handling X12 Interchanges

As X12 documents are sent within Interchanges you need to choose how InterSystems IRIS® should handle incoming documents. Especially if you need to access documents at the Group or Transaction Set level. This page describes different scenarios for handling X12 Interchange.

X12 Batch Handling

Batch Handling settings determine how InterSystems IRIS sends and receives documents. The choices you make here affect how your Business Processes should be configured.

Receiving Batch Documents

X12 business services have the Batch Handling configuration setting, which determines how to process incoming batch documents. The options are:

  • Whole Batch—Do not process child documents individually; accumulate and send the whole batch as one composite document.

  • Single-Session Batch—Forward all documents in the Interchange as part of a single session, including final parent document objects containing batch and group header and trailer segments.

  • Multi-Session Batch—Forward each document in the Interchange in its own session, followed by final parent document objects containing the batch and group header and trailer segments.

  • Individual—Forward each child document in the batch in its own session; do not forward parent batch document objects.

Note:

If you select Whole Batch, any transformations of individual Transaction Sets have to account for the Interchange and Group levels. See Configuring Business Processes for Whole Batch below.

Sending Batch Documents

On the outgoing side, X12 File and FTP business operations have the Auto Batch Parent Segs configuration setting. When Auto Batch Parent Segs is False (the default) the business operation outputs child documents, but does not output the batch headers and trailers. When Auto Batch Parent Segs is True, while outputting a message that has a batch parent, the business operation outputs the batch headers first, then the child documents, then follows up with the batch trailers when triggered by the final batch header message or by a file name change.

In situations where the trailing segments might not be written correctly, such as when the business service used Batch Handling = Individual, you can use the Auto Batch Completion Timeout setting for File and FTP business operations to ensure that trailing segments are written.

Batch Modes

The combination of Batch Handling and Auto Batch Parent Segs enables the following modes of operation for X12 batch documents:

Batch Handling Auto Batch Parent Segs Results
Whole Batch (any) Business service sends only the parent document; all child documents are referenced to it but not sent individually. Operation outputs entire batch at one time when it receives the parent document.

Single-Session

or

Multi-Session

True Service sends each child document as it receives and parses it, followed by the parent document when all children have been sent. The business operation outputs parent headers when it receives the first child document, then finishes up with trailers when it receives the parent document object. Trailer segments automatically contain the correct child count values.

Single-Session

or

Multi-Session

False This results in double output: the business operation sends out each child document individually, followed by the parent document containing each child document (again).
Individual False Business service forwards each child document in the batch in its own session and does not forward objects representing the batch headers and trailers. On the outgoing side, the business operation does the same.
Individual True Business service forwards each child document in the batch in its own session and does not forward objects representing the batch headers and trailers. On the outgoing side, the business operation does the same.

Configuring Business Processes for Whole Batch

If you choose to have the business service process incoming X12 documents in Whole Batch mode you need to configure the business process accordingly.

Routing Rules for Whole Batch

To properly route documents in Whole Batch mode, set the routing rule to accept Interchanges. Send to the relevant data transformation if necessary.

Create a new routing rule

  1. Ensure you are in the proper namespace and navigate to the Rule Editor page.

  2. Click New.

  3. Follow the instructions in Adding an X12 Routing Rule.

Edit the constraint

  1. Double click on the constraint rule item.

  2. Set the Source to your business service.

  3. Set the Message Class to EnsLib.EDI.X12.Document.

  4. Set the Schema Category as appropriate for your production.

  5. Choose Interchange from the Document Name selection.

For more information, see Using the Rule Constraint Editor.

Define the condition

Choose any conditional statement relevant to your production. If you always want the action to be applied, click on the condition rule item and type “1”.

Add a Send action

  1. Click on the when rule item.

  2. Click Send to add a send action.

  3. Double click on the transform rule item and select the appropriate data transformation.

  4. Double click on the target rule item and select the appropriate business operation from your production.

For more information, see Selecting the Transformation and Target of a Send Action.

Configuring Business Processes for Other Batch Settings

To transform X12 documents within productions with Single Session, Multi Session, or Individual mode you must create a separate data transformation for each type of X12 document the production encounters. For more information, see Developing DTL Transformations.

Routing Rules for Other Batch Settings

To properly route documents in Single Session, Multi Session, or Individual mode, create a routing rule set with a unique routing rule for each type of X12 document the production encounters.

To create new rules within the rule set:

  1. Click on ruleSet

  2. Click rule to add a rule

  3. Follow the instructions set in Routing Rules for Whole Batch

  4. When editing the constraint, be sure to set the Document Name to the appropriate X12 document type.

  5. When adding a data transformation, be sure to use a transformation written for the appropriate X12 document type.

Data Transformations for Other Batch Settings

To transform X12 documents within productions with Single Session, Multi Session, or Individual mode you must create a separate data transformation for each type of X12 document the production encounters. For more information, see Creating an X12 Data Transformation and Developing DTL Transformations.

See Also

FeedbackOpens in a new tab