XML join for multiple level complex group

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
suja.somu
Participant
Posts: 79
Joined: Thu Feb 07, 2013 10:51 pm

XML join for multiple level complex group

Post by suja.somu »

I have created a parallel job with a XML output( latest in Version 8.5).

I have shown here the level and type of XML join I used . The question here is what type of XML function I need to use to achieve multiple level complex group. ROLES are unbounded element. COVERAGE is also unbounded. For every ROLE, I need to have multiple coverages. How to implement this.


LEVEL ELEMENT GROUP TYPE OF XML JOIN
ROOT DOC MSG
1 DOC INFO HJOIN
2 POL INFO HJOIN
3 ROLES HJOIN
3 ATTACHMENT HJOIN
3 LIFE POLICY HJOIN
4 COVERAGE ????
suja.somu
Participant
Posts: 79
Joined: Thu Feb 07, 2013 10:51 pm

Post by suja.somu »

Portion of the schema shown below. There are many inputs to the XML stage. I joined all the links successfuly using HJOIN function(Key is Policy_Number). I could map the Roles group through Hjoin with Main input link. Coverage is a subgroup of Roles. I could not map this. I am not able to find where the issue is. If anyone who had faced a similar issue, please let me know the solution.


Document_Message ( root)
---> Document_Info
---------> Policy_Info
-----------------> Roles
-------------------------->Coverage
-----------------> Life_Policy
------------------------->Illustration

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2012 sp1 (http://www.altova.com)-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:element name="Document_Message">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Document_Info" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Document_Info">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Document_ID" minOccurs="1"/>
				<xsd:element ref="Policy_Info" minOccurs="1" maxOccurs="1"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Policy_Info">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Document_ID" minOccurs="1"/>
				<xsd:element ref="Policy_Number" minOccurs="1"/>
				<xsd:element name="Product_Version" type="xsd:string" minOccurs="1"/>
				<xsd:element name="Issue_State" type="xsd:string" minOccurs="1"/>
				<xsd:element ref="Roles" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="Life_Policy" minOccurs="1" maxOccurs="1"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Roles">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Policy_Number" minOccurs="1"/>
				<xsd:element ref="Role_Type" minOccurs="1"/>
				<xsd:element ref="Role_Group" minOccurs="0"/>
				<xsd:element ref="First_Name" minOccurs="1"/>
				<xsd:element ref="Middle_Initial" minOccurs="0"/>
				<xsd:element ref="Last_Name" minOccurs="1"/>
				<xsd:element ref="Name_Suffix" minOccurs="0"/>
				<xsd:element name="Agent_Number" type="xsd:string" minOccurs="0"/>
				<xsd:element ref="Coverage" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	[size=9][color=red]<xsd:element name="Coverage">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Policy_Number" minOccurs="1"/>
				<xsd:element ref="Role_Type" minOccurs="1"/>
				<xsd:element name="Coverage_Code" type="xsd:string" minOccurs="1"/>
				<xsd:element name="Coverage_ID" type="xsd:string" minOccurs="1"/>
				<xsd:element name="Coverage_Type" type="xsd:string" minOccurs="1"/>
				<xsd:element name="Form_Number" type="xsd:string" minOccurs="1"/>
				<xsd:element name="Coverage_Name" type="xsd:string" minOccurs="1"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd[/size]:element>
	[/color]<xsd:element name="Life_Policy">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Policy_Number" minOccurs="1"/>
				<xsd:element name="Maturity_Date" type="xPressionDate" minOccurs="1"/>
				<xsd:element name="Monthly_Initial_Guarantee_Premium" type="xsd:float" minOccurs="1"/>
				<xsd:element name="Monthly_Premium_Guarantee_Expiry_Date" type="xPressionDate" minOccurs="0"/>
				<xsd:element name="Death_Benefit_Option" type="xsd:string" minOccurs="0"/>
				<xsd:element ref="Illustration" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Illustration">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="Policy_Number" minOccurs="1"/>
				<xsd:element ref="Policy_Year" minOccurs="1"/>
				<xsd:element ref="Age" minOccurs="1"/>
				<xsd:element ref="Annual_Premium" minOccurs="1"/>
		</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Accumulated_Value_Average" type="xsd:float"/>
	<xsd:element name="Accumulated_Value_Current" type="xsd:float"/>
</xsd:schema>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Deal with each "independent" repeating node separately.....you need a "regroup" for every Parent/child/grandchild/great-grandchild repeating node that you need to define along each path. The "regroup" creates a higher level "list" (like a parent key) for the simple "list" of rows that comes in on an input link.

For example....

If (for one input link), you bring in rows that have:

Company, Department, Employee

Where there are many Employees in many Departments (Company and Department values are in sorted order and of course, repeat for each of the unique employees), then you need a ReGroup for Company, with Department and Employee as its children, and then a ReGroup for Department (being sure that the scope of that regroup is the result of the prior one), with Employee as its Children..... and so on and so forth, depending on how deep you need to go.

...then do that for each of the paths that you need. Work with only one single path until you get it right....in your case it sounds fairly complex, where the ReGroups that you specify will be "in the scope" of the result of your various hjoins....

Ernie
Ernie Ostic

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