DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
vik1979
Participant



Joined: 21 Oct 2010
Posts: 9

Points: 105

Post Posted: Wed Oct 18, 2017 3:44 pm Reply with quote    Back to top    

DataStage® Release: 9x
Job Type: Parallel
OS: Unix
Hello All,

I am using XML input stage for parsing XML files in a parallel job, would like to know how I can pass through XML parsing when repetitive element is not found when parsing.

Code:
<Store>
     <ID>
           <code>
                <Item extension="11"/>
            </code>
      </ID>
     <ID>
           <code>
                <Item extension="21"/>
            </code>
      </ID>
     <Container>
            <Stock code="abc"/>
     <Container>
            <Stock code="bcd"/>
</Store>

In above example, Store and ID elements are mandatory in the message and Container element is optional. I am parsing the XML keeping ID element as key, chunking out and parsing the Container info in next XML stage.
I am using below design in parsing. In XML stage 2, when Container info is missing in the message (as it is optional), no records are coming out of XML stage 2. I am using 'repetitive element required' unchecked in Transformation Settings and using Container ID as key.

[External Source] -> [ XML Stage 1 Parsing ID info ] - > [ XML Stage 2 Parsing Container info] -> Peek

Other option, I may have to parse out both elements separately and use a join stage to achieve this. But we are trying to minimize the number of the joins in the job. Would like to know if there is a way to make my first option work.

Thanks,
Vik.
vik1979
Participant



Joined: 21 Oct 2010
Posts: 9

Points: 105

Post Posted: Wed Oct 18, 2017 3:55 pm Reply with quote    Back to top    

First option is working fine. I changed the path I gave for 2nd XML stage.
Rate this response:  
Not yet rated
asorrell
Site Admin

Group memberships:
Premium Members, DSXchange Team, Inner Circle, Server to Parallel Transition Group

Joined: 04 Apr 2003
Posts: 1636
Location: Colleyville, Texas
Points: 22245

Post Posted: Thu Oct 19, 2017 10:52 am Reply with quote    Back to top    

I know you are on release 9 - but wanted to mention that the Hierarchical Stage in 11.3 does a better job of handling these situations. It has some different limitations but is usually more flexible than the XML stage. As long as your XSD (schema) defines it as a repeating element, the Hierarchical Stage should handle it whether it is there zero or more times.

If your site has 11.3 available (now or coming soon) then you might want to look at the Hierarchical stage.

_________________
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2017

Last edited by asorrell on Thu Oct 19, 2017 10:08 pm; edited 1 time in total
Rate this response:  
Not yet rated
eostic

Premium Poster



Group memberships:
Premium Members

Joined: 17 Oct 2005
Posts: 3715

Points: 29665

Post Posted: Thu Oct 19, 2017 11:25 am Reply with quote    Back to top    

As Andy notes, the Hierarchical stage can do some nice things.....but beware! It cannot handle parents with no children, when both are on the same link. xmlInput handles this fine, with unchecking ...

_________________
Ernie Ostic

blogit!
Open IGC is Here!
Rate this response:  
Not yet rated
vik1979
Participant



Joined: 21 Oct 2010
Posts: 9

Points: 105

Post Posted: Fri Oct 20, 2017 9:53 am Reply with quote    Back to top    

Thanks for the reply. I am unable to see your complete post, I need to get the premium access Smile
I will definitely look into the IBM notes for the Hierarchical stage in 11.3.
I am working on complex HL7 standard schemas, which has a lot of parent child relationships.
I tried XML stage before using XML input stage in 9.1, which was making it complicated to parse elements under each list into a separate output.. which will end up using too many joins to combine the data.
So, am trying to understand how hierarchical stage is different from XML stage. Thanks.
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours