Joinkey or Sort find the Parent company



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Joinkey or Sort find the Parent company

Postby Bala_mainframe » Tue May 17, 2022 8:27 pm

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
Bala_mainframe
 
Posts: 2
Joined: Tue May 17, 2022 7:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Joinkey or Sort find the Parent company

Postby sergeyken » Wed May 18, 2022 1:26 am

Can be done in SORT only with a predefined reasonable limit of allowed predecessors for each company.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Joinkey or Sort find the Parent company

Postby Bala_mainframe » Wed May 18, 2022 1:48 pm

Thanks !!
Could you please confirm best possible option to complete this
Bala_mainframe
 
Posts: 2
Joined: Tue May 17, 2022 7:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Joinkey or Sort find the Parent company

Postby sergeyken » Wed May 18, 2022 4:40 pm

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.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post