From last week's call:

6. 'Floating' definitions
A known element, the position of which can be anywhere in a sequence of other elements - is this something DFDL needs to support?  Capability is offered by IBM's WTX product.  Can be used for comments, but DFDL plans to handle comments post 1.0 using an explicit mechanism or using layering. Real purpose of floating component is for older EDI formats where there is a segment that can appear anywhere, and can appear any number of times. Action raised for IBM to provide a concrete example for discussion. The issue for DFDL is how does a floating component appear in the DFDL infoset, and how does it validate in the sequence. One possibility is a property dfdl:floating=yes/no and if an element has that property set, it can be expected anywhere when parsing, but appears in the correct point in the sequence in the parsed infoset, On unparsing it must appear in in the correct point in the sequence, and is output in that place.
036
SH: Provide use case for floating component in a sequence
08/04: Raised


Example below, kindly supplied by Stephanie Fetzer of IBM.

Regards

Steve Hanson
Programming Model Architect
WebSphere Message Brokers
Hursley, UK
Internet: smh@uk.ibm.com
Phone (+44)/(0) 1962-815848




FLOATING COMPONENTS
At one point In X12 segments could be:


    The NTE segment was the only usage of a floating component (meaning that it could appear anywhere within the bounds of the transaction) in X12.   It was used in many transactions but the most notable use was the 850 (Purchase Order), where it was used in versions up to and including  3060.  With version 3070 the NTE segment was removed from the 850.  In other transactions the NTE continues to be allowed, but it's position is now fixed in the transaction set.

IMPLEMENTATION

WTX Pack for X12 EDI Currently supports 8 version of X12 which allow the NTE component to float.  Below is an example of the implementation of NTE within these older  850 versions.  The NTE segment is defined as a physical segment along with all of the other non-floating segments in the SEGMENT partition of the type tree.




Then, instead of being used as a component in the Transaction it is defined as floating in the Transaction.


Now that cover the cases where the NTE segment could occur before during or after the components in the Transaction, however, the Transaction also included loops.


So for each of the loops the NTE could appear in any position there as well so each loop had the NTE defined as a floating component.



And for Loops that contain Loops - each child look had NTE defined as a floating Component





...Until we have defined the floating component for every construct which could contain segments.

HOW WIDELY USED in X12:

In the 2003 version we support Floating Components in the:
810,820,830,832,840,843,846,850,855,856,860,861,
862,863,865,867,869,870

In the 2040 version we support Floating Components in the:
810,820,830,832,840,843,846,850,855,856,860,861,
862,863,865,867

In 3010 version we support Floating Components in the:
810,820,830,832,840,843,846,850,855,856,860,861,
862,863,865,867

In 3020 version we support Floating Components in the:
810,830,832,840,843,846,850,855,856,860,861,862,
863,865,867

In 3030 version we support Floating Component in the:
810,830,832,840,843,846,850,855,856,860,861,862,
863,865,867

In 3040 version we support Floating Component in the:
810,830,832,840,843,850,855,856,860,861,862,863,865

In 3050 version we support Floating Components in the:
810,830,832,840,843,850,855,856,860,861,862,863,865

In 3060 version we support Floating Component in the:
850,860

In 3070 version and above we support Floating Components in:
{NONE}



DISCUSSION:
It is generally accepted that floating components are a 'bad idea' but they do crop up occasionally.  Although X12 now has a policy to not allow floating components for newer version they are still allowed in older versions.  Alternatives for modelling these are not very appealing.  They really cannot be unordered as everything except the NTE segment is ordered.  Another alternative is to have a choice at each possible position in the transaction of the ordered component and the NTE.  That just is not practical from a modelling perspective and would result in something that could not be mapped to or from without great acrobatics.

WTX users often use the Floating Component construct as a short-cut to avoid to avoid complex structures.  To be honest they are probably overused in existing user-created trees (outside of the packs) as it is very tempting  when your primary focus is validation to say...."I can have this thing appear almost anywhere" - I'll just slap it in as a FC. Where often come choice groups would be more appropriate.

The functional down-side of floating components is trying to create them on output.  As the floating component has no fixed location you can not map to it.  In the case of the NTE, users generally determine a fixed place to output the NTE and add the segment there (as optional so as to not impact input validation) so that the contents on an NTE can be mapped.

                                                                                                                     







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU