Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

X12 inbound message processing

Updated on April 23, 2021

Pega Foundation for Healthcare provides a pre-configured File Service rule instance called X12file.X12.X12Inbound that reads the X12 message input file and calls the activity X12ParseMessageStart to start the processing.

Pega Foundation for Healthcare

The X12ParseMessageStart activity includes Java that calls the X12ParseMessageType activity. This activity sets the type of transactions that are in each functional group. It then calls an activity that handles the given message type by calling the X12ParseMessage activity defined in the appropriate class (such as PegaX12-Data-N837).

The X12ParseMessage activity is composed of Java code that parses the message according to its message type (such as 837) to determine the segments and the context of where these segments lie within the message. With this information, the activity determines the classes that should be populated with the data and calls a Parse Delimited rule for each segment. The rule parses the data and puts the data onto the clipboard. After the entire functional group has been processed, an instance of the X12 data object is created.

The Java code in the activity uses the syntax of a given message type based on the segments used and the format of the transaction as defined in the associated EDI Implementation Guide. The code uses the following logic to parse the X12 message one segment at a time:

  1. Gather control information from the ISA, GS, and ST segments and determine the message type found in the GS functional group.
  2. Keep track of the current loop identifier and monitor when it changes. The loop identifier is hard coded into the Java code based on the message type. With the 837 message type, the starting loop ID is HEADER, which switches to the second loop 2000A. The loop ID can change when any of the following is found:
    • HL segment identifying a new Hierarchical Level
    • NM1 segment identifying a new sub-loop
  3. For each segment, identify the Parse Delimited rule name and the class that should be populated with this segments data. Invoke that Parse Delimited rule to populate the clipboard with the appropriate class and properties.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us