generating flat file from xml file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Ray,
I followed every step from Ernie's blog using External Source with "ls" in 7.5.x2 platform, it just wouldn't work complaining either invalid domain name or C: is invalid path or directory. I know that MKS Toolkit is available on 7.5x2, but when "ls" issued from the External Source stage, it just aborts the job. You know how buggy is for 7.5x2.
However, exact job and syntax running on my other 7.5.1A Linux machine works just fine.
I followed every step from Ernie's blog using External Source with "ls" in 7.5.x2 platform, it just wouldn't work complaining either invalid domain name or C: is invalid path or directory. I know that MKS Toolkit is available on 7.5x2, but when "ls" issued from the External Source stage, it just aborts the job. You know how buggy is for 7.5x2.
However, exact job and syntax running on my other 7.5.1A Linux machine works just fine.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The currently mapped drive's root is considered to be "/" for UNIX purposes*.
Therefore, if the DataStage project is on D: drive, then /tmp in UNIX is D:\tmp in Windows.
You may need to fudge things a little, using relative pathnames rather than unqualified pathnames, but "UNIX" commands like ls do work happily (given that the above snippet of knowledge is vital) from 7.5x2.
* The UNIX file system has a single root. Windows is a multiply-rooted file system.![Laughing :lol:](./images/smilies/icon_lol.gif)
Therefore, if the DataStage project is on D: drive, then /tmp in UNIX is D:\tmp in Windows.
You may need to fudge things a little, using relative pathnames rather than unqualified pathnames, but "UNIX" commands like ls do work happily (given that the above snippet of knowledge is vital) from 7.5x2.
* The UNIX file system has a single root. Windows is a multiply-rooted file system.
![Laughing :lol:](./images/smilies/icon_lol.gif)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
Hi lstsaur....i am following your idea of creating a server job. the job is running without any errors. It is showing that some rows processed between i/p seq file and xml i/p stage but shows zero rows between xml i/p stage and o/p seq file. I am getting the following warning:
XmlTest_server..XML_Input_1: XML input document value is empty or NULL. Column Name = "xmldoc"
What could be the reason?
XmlTest_server..XML_Input_1: XML input document value is empty or NULL. Column Name = "xmldoc"
What could be the reason?
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
Hi lstsaur....i am following your idea of creating a server job. the job is running without any errors. It is showing that some rows processed between i/p seq file and xml i/p stage but shows zero rows between xml i/p stage and o/p seq file. I am getting the following warning:
XmlTest_server..XML_Input_1: XML input document value is empty or NULL. Column Name = "xmldoc"
What could be the reason?
XmlTest_server..XML_Input_1: XML input document value is empty or NULL. Column Name = "xmldoc"
What could be the reason?
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
The following are descriptions for the columns in the o/p seq file:
/shiporder
/shiporder/@orderid
/shiporder/orderperson/text()
/shiporder/shipto/name/text()
/shiporder/shipto/address/text()
/shiporder/shipto/city/text()
/shiporder/shipto/country/text()
/shiporder/item/title/text()
/shiporder/item/note/text()
/shiporder/item/quantity/text()
/shiporder/item/price/text()
/shiporder
/shiporder/@orderid
/shiporder/orderperson/text()
/shiporder/shipto/name/text()
/shiporder/shipto/address/text()
/shiporder/shipto/city/text()
/shiporder/shipto/country/text()
/shiporder/item/title/text()
/shiporder/item/note/text()
/shiporder/item/quantity/text()
/shiporder/item/price/text()
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
UNIX commands don't work with Windows pathnames. Use the UNIX form of the pathname: for example ls -1 /tmp/*.xml (This assumes that DataStage server is installed on the C: drive.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 315
- Joined: Tue Oct 31, 2006 3:38 pm
Hi lstsaur,
Thanks for replying to my posts. I will give the example xsd and xml file that i used to create sample server job( seqfile----->xml i/p------->seqfile).
I created the table definition with xsd file and i used xml file as input in the job. Below are the xsd and xml file. Please let me know how i need to do the settings this job. If this job runs it will be very helpful for me to understand how xml stages work.
XSD
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
Thanks
Thanks for replying to my posts. I will give the example xsd and xml file that i used to create sample server job( seqfile----->xml i/p------->seqfile).
I created the table definition with xsd file and i used xml file as input in the job. Below are the xsd and xml file. Please let me know how i need to do the settings this job. If this job runs it will be very helpful for me to understand how xml stages work.
XSD
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
Thanks