Page 1 of 1

Joinkey or Sort find the Parent company

PostPosted: Tue May 17, 2022 8:27 pm
by Bala_mainframe
Hi All,

I would like to perform below task using joinkey or Sort.

I am trying to find the Ultimate parent company.

Example :

Input file:

Company             Immediate Parent Company
   
  A                          A                              
  B                          A
  C                          A
  D                          B
  E                          B
  F                          E
  G                          E
  Z                          Z
 

Expected output file:

Company                                            Immediate Parent Company                       Ultimate Parent Company
   
  A                                                                  A                                               A
  B                                                                  A                                               A
  C                                                                  A                                               A
  D                                                                  B                                               A
  E                                                                  B                                               A
  F                                                                  E                                               A
  G                                                                  E                                               A
  Z                                                                  Z                                               Z  
 

 


Basically Company and Immediate parent company are same ,then it can be considered as Ultimate parent company.
and if Company and Immediate parent company not same then ,need to search in Company field column using the Immediate Parent company value
to find the ultimate parent company

Re: Joinkey or Sort find the Parent company

PostPosted: Wed May 18, 2022 1:26 am
by sergeyken
Can be done in SORT only with a predefined reasonable limit of allowed predecessors for each company.

Re: Joinkey or Sort find the Parent company

PostPosted: Wed May 18, 2022 1:48 pm
by Bala_mainframe
Thanks !!
Could you please confirm best possible option to complete this

Re: Joinkey or Sort find the Parent company

PostPosted: Wed May 18, 2022 4:40 pm
by sergeyken
Bala_mainframe wrote:Thanks !!
Could you please confirm best possible option to complete this

Did you mean: can I do your job for you?
Yes, I can. But have no desire to do it in this manner.

This forum exists to help people doing their jobs, and to help them fix their mistakes, but not for doing their job from top to bottom.

One of possible options is, the JOIN operation supported by SORT utilities.

First of all, please try to do at least something by yourself.