XML repeating nodes

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
chaitanyavm
Participant
Posts: 8
Joined: Fri Apr 09, 2004 7:06 pm

XML repeating nodes

Post by chaitanyavm »

Hi ,

I have a job to generate simple XML with data. It works for some data but not all. Can anyone tell me how to upload the file?

Thanks
Chaitanya
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

dsjob -report XML will report on row counts for a job and if you process this with a job then it will not report on when there are no rows counts. If row count is your repeating group. It gives weird errors like square root of negative numbers and divide by zero.

You can process the same data twice and have no repeating groups to get the data missed. That is what I did.

I had to check the XML validate box to keep the jobs from aborting as well.
Mamu Kim
rkumar28
Participant
Posts: 43
Joined: Tue Mar 30, 2004 9:39 am

Post by rkumar28 »

Hi Kim,

I have something similar situation as Chaitanya. I am trying to read a XML source and write to a flat file. When I validate it I hit this error:

DataStage Job 67 Phantom 2588
Program "DSD.StageRun": Line 295, Square root of a negative number.
DataStage Phantom Finished.

I have unchecked the Repitition Element required, but it didn't help.

kduke wrote:dsjob -report XML will report on row counts for a job and if you process this with a job then it will not report on when there are no rows counts. If row count is your repeating group. It gives weird errors like square root of negative numbers and divide by zero.

You can process the same data twice and have no repeating groups to get the data missed. That is what I did.

I had to check the XML validate box to keep the jobs from aborting as well.
chaitanyavm
Participant
Posts: 8
Joined: Fri Apr 09, 2004 7:06 pm

Post by chaitanyavm »

Hi Kim/Kumar,

I have zip file with dsx file, schema file and data file. Can you tell me how to upload to this site so that some one can look at it?

Thanks
Chaitanya
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

There is no way to upload it to this site. Like I said no data will come out if the repeating elements are missing. If there are other columns that you need then you need to process it again without the repeating links. I tried doing it one data flow tih 2 links coming out and one link with repeating links and another without. This never worked because when you saved it then it seemed to change them both to repeating. I had to create 2 data flows and process the same data down both flows.

This did not work.

Code: Select all


              ->repeating link      -> transform1 -> output1
XML in <
              ->not repeating link -> transform2 -> output2
This worked.

Code: Select all


XML1 ->  repeating link      -> transform1 -> output1

XML2 ->  not repeating link -> transform2 -> output2

Try it.
Mamu Kim
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Responding to rkumar:
DataStage Job 67 Phantom 2588
Program "DSD.StageRun": Line 295, Square root of a negative number.
DataStage Phantom Finished.
This is a known problem with the XML pack on Sun Solaris. You should find that your job finished successfully despite this warning message, sometimes you can get multiple warnings, and Ascential support have this as a known issue and does no harm.

I had to change my error/warning reporting routine to prevent it from being sent to administrators.
rkumar28
Participant
Posts: 43
Joined: Tue Mar 30, 2004 9:39 am

Post by rkumar28 »

vmcburney wrote:Responding to rkumar:
DataStage Job 67 Phantom 2588
Program "DSD.StageRun": Line 295, Square root of a negative number.
DataStage Phantom Finished.
This is a known problem with the XML pack on Sun Solaris. You should find that your job finished successfully despite this warning message, sometimes you can get multiple warnings, and Ascential support have this as a known issue and does no harm.

I had to change my error/warning reporting routine to prevent it from being sent to administrators.

Hi,

Thanks Vincent for your reply...I tried running my job ignoring the warning..it ran fine but there were no data into my flat file. :(
Is it some problem with my settings that my data is not getting loaded into the flat file. I will really appreciate any help in this regards.

Also, is there another Stage available through which I can read XML source file. Currently, I am using folder stage to read the xml file.

Below is my XML that I trying to parse and put it in a flat file. I will really appreciate any advice and help to make this work.

Thanks
Raj


<batch recordCount="100" source="zyxmailxyz" createDate="2004-06-23 11:44:05">
<email transDate="10/23/2004" del="Y">
<eaddr>xyz@xyz.net</eaddr>
<newaddr>xyz1@xyz.net</newaddr>
<btn active="Y">1112223333444</btn>
<busresind>B</busresind>
<custcode>444</custcode>
<phone>3141234567</phone>
<perms>
<perm name="marketingcons" value="Y"></perm>
<perm name="ebill" value="Y"></perm>
</perms>
</email>
<email transDate="10/23/2004" del="N">
<eaddr>xyz3@xyz.net</eaddr>
<btn active="N">2112223333444</btn>
<busresind>R</busresind>
<region>R</region>
</email>
<email transDate="10/23/2004" del="Y">
<eaddr>xyz@xyz.net</eaddr>
<btn active="Y">3112223333444</btn>
<busresind>R</busresind>
<region>R</region>
<perms>
<perm name="xyz" value="N"></perm>
</perms>
</email>
</batch>
larryoceanview
Participant
Posts: 70
Joined: Fri Dec 26, 2003 3:14 pm
Location: Plantation, FL

Post by larryoceanview »

Hi,

I am trying to create a simple example using xml as input.
I am struggling through the documentation and can't find version 2 examples anywhere.

I have a folder input pointing at an xml file with a link going to an
xml input stage and then to a sequential file, I don't even know if this is legal cause the docs show it going to an odbc stage. But anyway I am getting the crazy square root error on a file not found.

It would be nice if Ascential provided troubleshooting error message for
this.

Is there some place where I can get a working example?
Is the datastage functionality for XML reliable enough for production?


Thanks,
Larry
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Download my EtlStats.zip. It has several jobs which will push job row counts into Oracle. It uses dsjob -report Project Job XML to get the XML file with row counts. It should work fine. The Oracle create table statements so you can store the row counts in a data warehouse table or you can switch them to hash files.

It is a mutiple instance job. We make the instance the job name in the actual dsjob -report job. There is a driver job named DSJobReportDbDriver which can look at a sequence and feed the DSJobReportDb job each job name in the sequence.

I copied the DSJobReportDb from DSJobReport posted on ADN. It had lots of problems and failed regularly. If a XML does not have any repeating rows like a sequence will never have row counts then that job will abort. If you try to extract multiple repeating groups in one XML transform like parameters and row counts then it will fail. So I had to process the XML 3 times. One for just job start end end times. One for row counts and one for parameters. I cleaned up this job a lot.

This job was designed to demostrate filters but I took filters out because I could not figure out why it failed so much. The XML code is fairly buggy. It gets warning for divide by zero and square roots of negative numbers. ASCL needs to clean it up. I am sure the next version will not have these issues.

We use these jobs at the end of every sequence so we always have current row counts. I have added some more jobs to extract job categories and other information about jobs which I will post soon. I think this metadata is important. I expect to relate a link to a table name soon. I think that will be vey important.

These jobs are Ds7.1. I hope these help other people learn XML. I learned a lot creating them. I think the html documentation is cool too.

You can download from my tips page below or from ADN. I am not sure if anyone is using this stuff so if you are then please tell me.
Mamu Kim
larryoceanview
Participant
Posts: 70
Joined: Fri Dec 26, 2003 3:14 pm
Location: Plantation, FL

Post by larryoceanview »

Thanks for the info.

I am running 7.5 and still getting the square root error message.
larryoceanview
Participant
Posts: 70
Joined: Fri Dec 26, 2003 3:14 pm
Location: Plantation, FL

What is the best way ...

Post by larryoceanview »

Can you go from an XMLINPUT file throught a regular transform to a sequential file.

What I want to do is

1) read an XML file

2)write the data to a sequential file with different coulmn attributes.

So I want to move the data in a xml file to a flat file.

Does it have to go to a odbc or database stage first?

Is this possible, if so is this the right approach, if not what is the best approach?


Thanks,
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Sure, it works just works like any other source. You can route it anywhere. Download those jobs. It will give you some ideas.
Mamu Kim
Post Reply