A pretty straightforward XML question

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
w951bvc
Participant
Posts: 12
Joined: Mon Aug 16, 2004 10:53 am
Location: Milwaukee, WI

A pretty straightforward XML question

Post by w951bvc »

Hello;

Reading in hierarchical XML (from an ISD or flat file) and running through any of the available 8.7 XML stages, at some point when I connect to another stage all of the fields need to be explicitly defined.

That being the case, is there any mechanism in 8.7 to handle repeated XML nodes of an unlimited number? For example, if a customer record could have unlimited phone numbers - is there a way to recognize and process all of them?

I believe I need to explicitly declare PHONE1, PHONE2, etc columns out of my XML stages, which obviously limits me to the number I've chosen to define. Is there any way to correctly handle such truly unlimited XML nodes in 8.7?

While I'm quite familiar with Datastage, I've only recently started using XML. Since last week I've been playing around as well as reading a lot of postings and IBM documents; and from what I can tell there simply isn't a way to do this. Which frankly I didn't think there would be, but I though I would pose the question before I gave up completely!

Any suggestions (not looking for details, just to be pointed in the right direction) or comments are greatly appreciated.

Thanks for your time,

Richard C.
Milwaukee, WI
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hi Richard...

Welcome to the world of xml and DataStage!

DataStage looks at repeating nodes as you describe as a "set" of "child values" potentially related to a particular parent. This is no different than a 1:many relationship between tables in an rdbms, or the repeating group in a VSAM structure coming from the mainframe.

You declare the "customer" one time and the repeating "phone numbers" one time, and then DataStage will produce "n" rows....as many rows as there are instances of the repeatable node. That could be 1, none, or 10's of thousands......

Getting it to work depends on how you set up your metadata, which stage you are using (xml or xmlInput), where you put the "repeating element" and to some degree, what the structure looks like. Most "well designed" xml documents will work just great. Every once in awhile you'll find a poorly designed document that needs some other tricks.

Check out my blog (url below) for other notes on xml and ds.

Ernie
Ernie Ostic

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