XML Stage with Imbedded LIST

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
DGoud
Premium Member
Premium Member
Posts: 2
Joined: Tue Sep 11, 2007 1:59 am
Location: NICE Sophia Antipolis

XML Stage with Imbedded LIST

Post by DGoud »

Hello all.
Here is the setup :
I have a number of Flat Files in Input, one per segment type (set of data with same schema mapping) and with one key in commun (like a Contract Number for exemple) to link them all and a key field to identify each segment.
There is a complex XML Message (which includes a group of segments of data) which can be repeated 1 to 99 times (i.e. a GROUP LIST in XML assembly terms) : this is my Output.
Within that Group of segments of data, there is one segment which can also be repeated 1 to 99 times (i.e. a LIST)
The Mapping section of the XML Composer Step requires a high level entry to be the input of the high level XML entry corresponding to the group.

My question is :
Which combination of Steps like HJoin, Regroup, OrderJoin... (or which external setup) do I need to use to create the right Input to the XML Composer Step to match the High Level entry required by the XML ?

Please note that when I have a non-Iterative Group including several segments and some iterative segments, the Mapping section of the XML Composer Step does NOT ask for a High Level Group entry, but simply requires the entries for each segment, and so I do not have any issue then.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hi...

It takes awhile to get used to the way that the Assembly works, but basically, you first have to take your inputs (your input links), which each are, by nature, singular flat "lists", and do a "regroup" on them to break them into "little hierarchies". You (ultimately) need a separate re-group step for every "key" that goes down a path of your hierarchy (that is per link).

I tend to go down thru the hierarchy level by level. So, if my root at the top is based on "companyID" (for example), I will regroup each incoming link by company id.... and then hjoin them based on this new key. Then...from the result of that join, do a regroup for the next level....

...and so forth. It takes some getting used to, as well as a re-orientation in your head so that you understand why you might get a "mismatch" of list to singular relationships when doing the mappings (an annoying message initially, but one that you will get comfortable in assessing).

Just be sure to VERY carefully review the "scope" pull down when doing re-groups --- to know which list you are working on, especially when nesting them deeply.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
DGoud
Premium Member
Premium Member
Posts: 2
Joined: Tue Sep 11, 2007 1:59 am
Location: NICE Sophia Antipolis

Post by DGoud »

Hi Ernie.
Thanks for your reply, it helped.
It sure does take a while to get used to the way Assembly works, but I have finally managed it, solving my problem by a combination of REGROUP, ORDER JOIN and HJOIN steps within my XML Stage.
Basically the trick is to prepare the data before the stage so that each "LIST" (or "child") level of data has a key to refer to its "parent", then use the HJOIN to link them together, LIST by LIST, level by level.
As you mentioned, REGROUP is also very useful.
ORDER JOIN is interesting when two LISTS have to be intertwined into one.
Thanks again, and good fun to all playing with XML Stage !
Dom.
Post Reply