XML ouput stages help needed badly!! :(

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
Vinothbaskaran
Participant
Posts: 22
Joined: Mon Aug 25, 2008 4:01 am

XML ouput stages help needed badly!! :(

Post by Vinothbaskaran »

Input :


requestID COLUMN1 COLUMN2 COLUMN3
1010 1 2 3
1011 Null 4 Null


Output:

<TCRMService>
<RequestControl>
<requestID>1010</requestID>
</RequestControl>
<TCRMTx>
<DataStatusBObj>
<DataValue>COLUMN1</DataValue>
</DataStatusBObj>
</TCRMTx>
</TCRMService>


<TCRMService>
<RequestControl>
<requestID>1010</requestID>
</RequestControl>
<TCRMTx>
<DataStatusBObj>
<DataValue>COLUMN2</DataValue>
</DataStatusBObj>
</TCRMTx>
</TCRMService>

<TCRMService>
<RequestControl>
<requestID>1010</requestID>
</RequestControl>
<TCRMTx>
<DataStatusBObj>
<DataValue>COLUMN3</DataValue>
</DataStatusBObj>
</TCRMTx>
</TCRMService>

This is my required output. In total there are 4 source columns requestID and Column1,Column 2,Column 3. Also the <Requestcontrol> part should repeat for every XML generated based on COLUMN1..2..3..
I have achieved the above. But whenever any value is null in either one of the COLUMN1..2..3.. , that XML part should not be generated. For instance if COLUMN1 and COLUMN 3 are null for request ID 1011. Then my output should be:

<TCRMService>
<RequestControl>
<requestID>1011</requestID>
</RequestControl>
<TCRMTx>
<DataStatusBObj>
<DataValue>COLUMN2</DataValue>
</DataStatusBObj>
</TCRMTx>
</TCRMService>

How do i do this? Badly.. Waiting for your thoughts.. Also have a look at my job design! i m new to XML n datastage.. is the design the optimised one???
Vinothbaskaran
Vinothbaskaran
Participant
Posts: 22
Joined: Mon Aug 25, 2008 4:01 am

hi..

Post by Vinothbaskaran »

I tried to paste pictorial rep of job.. din work!! sorry!!! :(
Vinothbaskaran
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...be sure that the column is nullable and "truly" null. The element for that row will not be written (by default if you don't make any special selections).

The default behavior of not writing the element requires that the value be truly NULL and not just "empty" (blank).

Check your column values using isNull() to verify that in fact they are null.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply