XComposites and MComposites
A composite is a set of related data elements.
The ANSI standards incorporated the first composite in version 3030. In an ANSI X12 schema, the X12 composite data structures are found under the XComposite category, where the X stands for X12.
In addition, other sets of elements that ANSI does not define as composites are defined as composites. These are located under the MComposite category. MComposites were formed to identify repetitive patterns of data elements and to group elements that are logically related.
Defining the composites in this manner simplifies type definitions and mapping rules. In addition, it is easier to identify which elements are required when others are present (or absent, as the case might be). For example, the third component of the ACT segment is MComposite:.
The ANSI X12 documentation states the following rule about two elements of the ACT segment:
P0304 - If either ACT03 or ACT04 is present, then the other is required
(where ACT03 is the IDCdQual'r Element and ACT04 is the IDCd Element).
If the data elements were defined as components of the ACT segment, a complex component rule, equivalent to the ANSI rule above, would be necessary. Instead, the two elements were defined as components of an IDCd MComposite:
The IDCd MComposite is then a component of the ACT segment, and is optional with a range of (0:1). This means that if an IDCd MComposite is in the data, both of its components must exist. In addition, if there is no IDCd MComposite in the data, neither component is there. Defining the data in this way meets the requirements of the ANSI standards and simplifies the type definition.
Another difference between XComposite types and MComposite types is their delimiters. The delimiter of an XComposite type is the Composite Delimiter, which appears as data in the ISA. The delimiter of an MComposite is the Element Delimiter.