Page 1 of 1

Number of records in XML

Posted: Wed Jun 16, 2010 12:59 am
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

Posted: Wed Jun 16, 2010 2:00 am
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.

Posted: Wed Jun 16, 2010 2:52 am
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.

Posted: Wed Jun 16, 2010 6:13 am
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.

Posted: Wed Jun 16, 2010 6:37 am
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

Posted: Wed Jun 16, 2010 7:01 am
by Sreenivasulu
You need to specify the 'repetition element' which will determine the number of records.

Regards
Sreeni