IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Flatten out a hierarchy?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Fri Jan 25, 2008 1:38 pm
Reply with quote

Hi Experts!

I have an exciting task for you... icon_razz.gif I have a hierarchy structure in a database unloaded to a dataset. The data has the following layout:

ID1ID2
ID1ID3
ID3ID6
ID2ID4
ID4ID5
etc

...where the leftmost ID is the parent of the rightmost each ID. So, the top of each hierarchy is defined as an ID not present in the rightmost side, ie. the ID only has parent relations. There can be max. 9 levels in the hierarchy, and each ID is defined as ZD 20. Each ID can only be present in ONE hierarchy structure.

My requirement for output is a flat version of the hierarchy, meaning I need one record per top point of each hierarchy, including all the IDs that belongs to it. In the example given, the output would be:

ID1ID2ID3ID6
ID2ID4ID5

Any help appreciated! icon_wink.gif
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Fri Jan 25, 2008 3:11 pm
Reply with quote

On second thoughts... I'd prefer the output this way:

For each hierarchy a unique (sequence) number followed by the each ID. So for the input shown:

0000001ID1
0000001ID2
0000001ID3
0000001ID6
0000002ID2
0000002ID4
0000002ID5

One importent remark on the input: It's not ordered so that each hierarchy is grouped together.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split a file in 2 with hierarchy SYNCSORT 12
No new posts XML Generate - Hierarchy of the Outpu... COBOL Programming 1
No new posts what is the hierarchy of a cobol prog... COBOL Programming 9
No new posts DB2 Query to get the Hierarchy DB2 3
No new posts Retrieving only one side of hierarchy IMS DB/DC 7
Search our Forums:

Back to Top