XML Stage Question...

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

XML Stage Question...

Post by kaps »

I have a XML file like this...

[code]<?xml version="1.0" encoding="UTF-8"?>
<insertRow subName="XPUB_FinTrx" srcOwner="DEV1" srcName="FINANCIAL_TRANSACTION">
<col name="ID" isKey="1">
<bigint>
<afterVal>1</afterVal>
</bigint>
</col>
<col name="CCID">
<varchar>
<afterVal>DUE</afterVal>
</varchar>
</col>
<col name="AMOUNT">
<decimal>
<afterVal>56.25</afterVal>
</decimal>
</col>
<col name="CC">
<char>
<afterVal>USD</afterVal>
</char>
</col>
<col name="EXT_REF">
<varchar>
<afterVal xsi:nil="1"/>
</varchar>
</col>
</insertRow>
[/code]

I can process this XML file using Column Description of XML Input stage and get output file like this...

[code]
SubName SrcOwner SrcName Name Value
--------------------------------------------------------------------------------------
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION ID 1
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION CCID Due
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION AMOUNT 55.55
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION CC USD
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION EXT_REF 1
[/code]

But I am just wondering if there is any way I can get the output like this...

[code]
XPUB_FinTrx DEV1 FINANCIAL_TRANSACTION 1 Due 55.55 USD 1
[/code]

I would like to know if I can do this withink XML or any other ways to do it...I read some post about vertical pivots but I could not make it to work...

I appreciate your ideas...
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Running those line via a transformer stage and concatenating the info, outputing it to a hashed file stage with the first part as key would result in the desired output row.
Naturally you'll also nee some stage variable to check when you changed your ID and such...

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Roy...Thanks for your reply. I got it done using xpath of XML stage.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Seems I must have missunderstood your question at that time :oops:
Glad you found the solution on your own :)
(You could have also used the folder stage, but I prefer the xpath as well)
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Post Reply