Multiple Repition Elements in XML

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
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Multiple Repition Elements in XML

Post by synsog »

I am getting
Error: The column of the output link is relative.
Error occurred in call to ORPHCallActivePluginInitialize().
The runLocally() of the operator failed.

Here is my part of XML:
- <ns9:ProgressiveQuoteChoice>
- <ns9:ProgressiveAutomobileQuote>
<ns9:sourceOfBusiness>Progressive.com</ns9:sourceOfBusiness>
<ns9:processDate>2012-03-21-04:00</ns9:processDate>
- <ns9:QuoteOptions>
- <ns9:QuoteOption>
<ns9:sequence>1</ns9:sequence> <ns9:totalQuotePremium>4445.00</ns9:totalQuotePremium>
<ns9:dividendOption>false</ns9:dividendOption>
- <ns9:Coverages>
- <ns7:Coverage>
<ns7:type>Liability</ns7:type>
- <ns7:Coverages>
- <ns7:Coverage>
<ns7:type>Bodily Injury</ns7:type>
<ns7:effectiveFromDate>2012-03-21-04:00</ns7:effectiveFromDate>
<ns7:effectiveToDate>2013-03-21-04:00</ns7:effectiveToDate>
<ns7:description>$50,000/100,000</ns7:description>
- <ns7:Limits>
- <ns7:Limit>
<ns8:amount>100000</ns8:amount>
<ns7:limitType>Incident</ns7:limitType>
</ns7:Limit>
- <ns7:Limit>
<ns8:amount>50000</ns8:amount>
<ns7:limitType>Person</ns7:limitType>
</ns7:Limit>
</ns7:Limits>
- <ns7:Premiums>
- <ns9:Premium>
- <ns9:AnnualPremium>
- <ns9:Amount>
<ns8:amount>700.00</ns8:amount>
</ns9:Amount>
</ns9:AnnualPremium>
- <ns9:NetPremium>
- <ns9:Amount>
<ns8:amount>700.00</ns8:amount>
</ns9:Amount>
</ns9:NetPremium>
- <ns9:NetOnBooksPremium>
- <ns9:Amount>
<ns8:amount>700.00</ns8:amount>
</ns9:Amount>
</ns9:NetOnBooksPremium>
</ns9:Premium>
</ns9:QuoteOption>
</ns9:QuoteOptions>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

This doesn't tell us enough to help.

Create another Job. Have just "one" link coming from your xmlInput Stage. Send it to flat file. Make sure that link is retrieving a particular single repeating node (and its parents) correctly. Then proceed to create another link for any other lowest level repeating nodes you may wish to retrieve in the same Job.

At quick glance, it looks like you might be wanting a link for "limits"....and another link for "premium amounts", etc.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Got same error...

Post by synsog »

Hi Ernie,

As you mentioned, I kept only 1 XML input stage and tried to pull the XML chunk into a flat file; I am getting; Now if i replace the flat file and put another XML input stage to further falttern the XML , it is throwing error:

XML_Input_185: XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 0, column: 0):
An exception occurred! Type:RuntimeException, Message:The primary document entity could not be opened. Id=D:\IBM\InformationServer\Server\Projects\projectPG

Here, in my XML file,
I have 3 huge chunk
Coverages, Inusrable Objects, PolicyInformation;
Here coverage is repetitive element,under each coverage again, some more coverages are there as repetitive element. Under each coverage, it has limit,permeiums. Again Limit is repetitive;
Like wise, InsurableObjects have same structure.. I need to flattern the xml data file ... i Please hlep me...
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

This new error has nothing to do with repeating elements.... check out this entry and then use the External Source stage to read your file...

http://dsrealtime.wordpress.com/2007/12 ... -a-source/

...and if you are using an intermediate flat file between jobs, be sure to use NO formatting (no quote character and no delimiter) when you write out the initial chunk.

Each LOWEST level repeating element will dictate the need for a link. So...the amounts under premiums will have their own link. Write that Job and get it working.

Then write another job, or add a link, that pulls informtaion from Coverages....etc.

...keep in mind that under Coverage, you may have other "independently" repeating nodes. Each one must have its own link and will generate rows.

Think of something like a purchase order...it has line items and it also might have multiple addresses. You'd need one link for each.... for a list of address (multiple rows) and a list of line items (multiple rows) being retrieved.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Post by synsog »

Hi Erine,
Thanks for your reply;
Then, even before your reply, I resolved, i did the same thing which you mentioned in your reply :-)
In XML for each of "independently" repeating nodes, each one must have its own link.

<purchase order>
<items>
<address>

So item will have product info..
<item>
<product>
<desc>

so .. if repetetive element is there under product then, we need a seperate link

then under address also we might have repetetive element , so we need a seperate link like wise..
It worked out...

:Thanks: :D
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Congrats! It takes a little getting used to, but basically, this is exactly what you need to do in order to tear apart any form of hierarchy. Turn it into the "rows" that it might be if the source XML were instead just a big collection of relational tables with some common keys (the higher level elements). Really complex flat files from legacy mainframe applications, with deeply nested and independent repeating groups aren't any different.

The new xml Stage does this more efficiently, by processing the hierarchy (and its unique paths) "within" the stage, but ultimately it needs you to do the same thing --- decide which paths are important, which aren't, and to then retrieve, combine, pivot, aggregate or summarize them as you desire, like you would with a random set of flat or rdbms sources.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply