XML Output Stage Usage

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
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

XML Output Stage Usage

Post by balu536 »

Hi,
I've a requirement where i need to extract the data from Flat file and load it to XML File. The sample XML File given to me is mentioned below.

Please help me on this.

Code: Select all

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <report xmlns="http://www.***.com/reportSchema">
 - <jobSummary>
  - <jobDefinition>
      <jobName>TARGET LOADER</jobName> 
	  <frequency>HOURLY</frequency> 
	  <sourceSystem>SOURCE</sourceSystem> 
	  <targetSystem>TARGET</targetSystem> 
	  </jobDefinition>
	  <redwoodJobID>1</redwoodJobID> 
	  <startDate>20120408060000</startDate> 
	  <endDate>20120408060000</endDate> 
    </jobSummary>
- <workSliceStatistics>
	  <parentRunId>2207</parentRunId> 
- <workSliceDetails>
- <workSliceDetail>
 	 <workSliceDate>20120408060000</workSliceDate> 
 	 <sourceSystemNbr>9360</sourceSystemNbr> 
 	 <insertNbr>9360</insertNbr> 
 	 <updateNbr>0</updateNbr> 
 	 <deleteNbr>0</deleteNbr> 
 	 <distinctNbr>0</distinctNbr> 
  </workSliceDetail>
  - <workSliceDetail>
   	 <workSliceDate>20120505050000</workSliceDate> 
   	 <sourceSystemNbr>5897</sourceSystemNbr> 
   	 <insertNbr>2546</insertNbr> 
   	 <updateNbr>120</updateNbr> 
   	 <deleteNbr>365</deleteNbr> 
   	 <distinctNbr>457</distinctNbr> 
  </workSliceDetail>
  </workSliceDetails>
  </workSliceStatistics>
- <logDetails>
- <logDetail>
  	<detailRunId>10</detailRunId> 
  	<logDetailHeader>MapReduce Jobs</logDetailHeader> 
  	<logDetailContent>http://****.***.com:50030/jobdetails.jsp?jobid=job_201207171652_0196</logDetailContent> 
  </logDetail>
- <logDetail>
  	<detailRunId>11</detailRunId> 
  	<logDetailHeader>System Error</logDetailHeader> 
  	<logDetailContent>Exception stack trace</logDetailContent> 
  </logDetail>
  </logDetails>
  </report>
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Post by balu536 »

Please help on how to configure the XML Output Stage for this requirement.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First step would be to get your hands on an xsd and import that metadata so you can properly configure the XML Output stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Post by balu536 »

Hi,
I've imported the xsd and defined the key column in meta data. Please help on steps to be followed in XML Output Stage
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm sure those steps are documented in the manuals. I'm curious how much XML experience you have, both in general and with DataStage in particular? It can get very... confusing... if this is your first exposure to the Wonderful World of XML.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

The best sites to learn about Xpath. XSLT and XML are the w3 websites.
Tutorials will help , but w3 gives you an understanding that surpasses all else ( at least to my knowledge) - since all explanations are detailed and verbose - though not everyone likes it that way . The XML pack reference in datastage is good if you are just starting with XML stages - please inform your managers about the skills gap if you are unfamiliar- I assume you work for an organization that understands timely and open communication.

Xpath specification : http://www.w3.org/TR/xpath/
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Also make sure you understand a couple of things:

1. The dashes in your desired output are not part of the actual XML but rather an artifact of your display tool - IE, I assume.

2. Do not worry about all of the formatting your example shows - you format ('pretty print') XML for peoples, not for consumption by other systems. Each XML file is perfectly happy to be a stream of characters, i.e. "one long record".
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply