Number of records 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
pklcnu
Premium Member
Premium Member
Posts: 50
Joined: Wed Aug 06, 2008 4:39 pm

Number of records in XML

Post by pklcnu »

Dear Experts

We are producing XML files as target out puts.
How to get the record count of XML file using DataStage ?

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How do you define a "record" in your XML? One solution would be to count the number of instances of record end-tags that pass by.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You are using version 8 so you can turn on operational metadata and collect row counts for every stage in your job - including the number of rows sent to your XML output stage. This would match the XML record count if you were writing relational records out in a simple repeating XML format.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

XML files don't have "records" in the sense that a traditional flat file would. As noted, about all that makes sense are the number of records that you sent to the stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Ditto to everything above.....another thing to consider is to not let the XMLOutput Stage do the actual i/o ....if the xml documents aren't extrememely large, put an output link on the xmlOutput Stage with a single column....called it something like "myXMLoutput" with a longvarchar datatype and some long length....send "that" row to disk with a downstream Seq stage or other. Then you will get two row counts ---- the rows going into xml, and the "chunks" or "documents" of xml that are coming out. In many situations people aggregate the whole thing and it's just "1" document as a result, but if you are doing something fancy with triggers and such, you'll get an accurate count of "n" xml documents or chunks.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

You need to specify the 'repetition element' which will determine the number of records.

Regards
Sreeni
Post Reply