XML Output stage Issue

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
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

XML Output stage Issue

Post by Aquilis »

Hi all,

I need to convert the pipe delimited data to the XML format message to put/write this message in to MQ.I am able to convert the sequential file data to XML data but not in the proper order as i am expecting.
I searched about this in the whole forum,and few members are already faced the same problem,but no body has mentioned any solution or work arounds.Now my problem is :

Exact Expected result Is:

- <statistics>
- <stat>
<statCode>RDTIMESECS</statCode>
<statValue>100</statValue>
</stat>
- <stat>
<statCode>R_REC_NUM</statCode>
<statValue>200000</statValue>
</stat>
- <stat>
<statCode>NTTIMESECS</statCode>
<statValue>100</statValue>
</stat>
- <stat>
<statCode>NRECNUM</statCode>
<statValue>200000</statValue>
</stat>
</statistics>

But when the Xpath is imported it will import only Two fields statcode & stavalue,but for these columns i need to push Eight Fields of data.

1).If I change the Xpath and add six more Xpaths with same name ,then whole data will get Concatenated like as shown below:

<statistics>
<stat>
<statCode>RDTIMESECSR_REC_NUMNTTIMESECSNRECNUM</statCode>
<statValue>100200000100200000</statValue>
</stat>
</statistics>


2).If I change the Xpath and add six more Xpaths with different names ,then whole data will get Concatenated like as shown below:

<statistics>
<stat>
<statCode1>RDTIMESECS</statCode1>
<statValue1>100</statValue1>
<statCode2>R_REC_NUM</statCode2>
<statValue2>200000</statValue2>
<statCode3>NTTIMESECS</statCode3>
<statValue3>100</statValue3>
<statCode4>NRECNUM</statCode4>
<statValue4>200000</statValue4>
</stat>
</statistics>

But that too in single Node <stat>.
My expectation was statCode1 & stavalue1 should come under One Node.
again statCode2 & stavalue2 should come under another second Node and so on......
In the whole thing name of the Node remains same as <stat> like:
<statistics>
- <stat>
<statCode1>RDTIMESECS</statCode>
<statValue1>100</statValue>
</stat>
- <stat>
<statCode2>R_REC_NUM</statCode>
<statValue2>200000</statValue>
</stat>
- <stat>
<statCode3>NTTIMESECS</statCode>
<statValue3>100</statValue>
</stat>
- <stat>
<statCode4>NRECNUM</statCode>
<statValue4>200000</statValue>
</stat>
</statistics>
Aquilis
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: XML Output stage Issue

Post by chulett »

Aquilis wrote:But when the Xpath is imported it will import only Two fields statcode & stavalue,but for these columns i need to push Eight Fields of data.
That's because there are only two elements. Doesn't matter how many 'fields of data' you have. I would think you just need to use the two and then mark one as the Repetition element. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Re: XML Output stage Issue

Post by Aquilis »

I have the sequential file with the pipe delimited data as given below:



aaaa| 1000|bbbb |2000| cccc|3000|dddd| 4000



And I want have the output as given below:



- <statistics>
- <stat>
<statCode>aaaa </statCode>
<statValue>1000</statValue>
</stat>
- <stat>
<statCode>bbbb</statCode>
<statValue> 2000</statValue>
</stat>
- <stat>
<statCode>cccc</statCode>
<statValue> 3000</statValue>
</stat>
- <stat>
<statCode>dddd</statCode>
<statValue> 4000</statValue>
</stat>
</statistics>



My dataflow will be:



Sequential File------------>Transformer------------>XML output------------->MQ plugin



Now my question will be:

In sequential stage I have 8 fields so I will have 8 fields as input for Transformer. When I will import above XML structure from the xml file
in XMl output stage, then I will be having only two fields, (i.e statcode & statvalue.) with XPath as given below.


/statistics/stat/statCode/text ()


/statistics/stat/statValue/text ()



So In transformer output I'll be having only two fields. So how can I join 8 fields to only 2 fields (statcode & statvalue)?
Aquilis
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Pivot them (your data pairs) out into individual records.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

Craig,

Thank you
It worked out fine.
Aquilis
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Time to mark the thread as Resolved, then?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply