More than one XML Repetition path

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
bakul
Participant
Posts: 60
Joined: Wed Nov 10, 2004 2:12 am

More than one XML Repetition path

Post by bakul »

A similar message has been posted earlier on the RTI Forum. I am posting it here(with updations) hoping that I might get a response. :)

I want to generate an XML document of the form

Code: Select all


<header>
<city name='CIT'>
  <customer> 
     <name></name>
     <account></account>
   </customer>
   <customer>
     <name></name>
     <account></account>
   </customer>
   <branch>
     <name></name>
     <service></service> 
   </branch>
   <branch>
     <name></name>
     <service></service> 
   </branch>
</city>
</header>
Now to do this I have to make both /header/city/customer and /header/city/branch as repetition paths. The input to XML consists of 5 columns. The input is of the form:

Code: Select all



city     branchname branchservice customername customeraccount
CIT      ABC         Loan              cust1            A1
CIT      XYZ         Loan              cust2            A3

                                
Both /header/city/customer and /header/city/branch (dummy columns) are specified as repetition paths. So now the problem is that for each row of branch and customer account a new city tag is created instead of one city tag.

I want to ask if it is possible to generate such a document using the XML output stage(either in Server or in Enterprise Edition).

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

Post by kduke »

You cannot read these 2 repeating groups in a server job in one link. It will give you an error. I had this issue in EtlStats. The dsjob.exe will export row counts as XML. There are repeating groups for parameters and links names.

I would process this a sequential file with one column and build the tags manually.
Mamu Kim
bakul
Participant
Posts: 60
Joined: Wed Nov 10, 2004 2:12 am

Post by bakul »

Could you please give me an example of how to generate XML using sequential file?
Regards,
Bakul
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Build a stage variable. Add a CrLf or just Cr for each entry.

svRow = ""
svRow = svRow : "<city name='" : Link.City: "'" : CrLf
... next col

CrLf should be a stage variable set it to char(13):char(10).
Mamu Kim
Post Reply