Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sorting the records in parent child relationship

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
manoopatil

New User


Joined: 07 Dec 2003
Posts: 56
Location: Montreal

PostPosted: Wed Dec 03, 2008 1:55 am    Post subject: Sorting the records in parent child relationship
Reply with quote

I need to sort the input given in the following format.

Code:

ACCENURE1 1847709                         ACCENURE1
ACCENURE1 0222139                         ACCENURE1
ACCENURE1 41T6020707                      ACCENURE1
ACCENURE1 70N6037226                      ACCENURE1
ACCENURE1 08SQCA101384NBWK                0222139
ACCENURE1 5064449120             847709   1847709
ACCENURE1 05DHAT858102BLCA       285250   41T6020707
ACCENURE1 999                    285250   41T6020707
ACCENURE1 05DHAT858103BLCA       285250   41T6020707
ACCENURE1 999                    354035   70N6037226
ACCENURE1 01IPCD875986           354035   70N6037226
ACCENURE1 DG0054                 285250   999
ACCENURE1 DG0060                 285250   999
ACCENURE1 DG0001                 354035   999


The records in input are sorted by first column - Master Cust. and fourth column Parent Name. second and third columns are Child Name and Sequence Number respectively.

The output is required in the following format with following rules

Code:

ACCENURE1 0222139                         ACCENURE1
ACCENURE1 08SQCA101384NBWK                0222139
ACCENURE1 1847709                         ACCENURE1
ACCENURE1 5064449120             847709   1847709
ACCENURE1 41T6020707                      ACCENURE1
ACCENURE1 05DHAT858102BLCA       285250   41T6020707
ACCENURE1 05DHAT858103BLCA       285250   41T6020707
ACCENURE1 999                    285250   41T6020707
ACCENURE1 DG0054                 285250   999
ACCENURE1 DG0060                 285250   999
ACCENURE1 70N6037226                      ACCENURE1
ACCENURE1 01IPCD875986           354035   70N6037226
ACCENURE1 999                    354035   70N6037226
ACCENURE1 DG0001                 354035   999


1. In output first record is sorted child with parent same as master cust.

2. The next record should one where parent is same as child in previous
record i.e. 0222139

3. If there is no record with parent equal to child in previous record then
record with parent equal to parent in previous record should come.

4. Also note '999' is a child under two different parents. In one place
sequence number is - 285250 where as in another place the sequence
number is 354035. As we can see the records with same sequence
number should be in sequence subject to the parent child relationship.

5. There can be multiple master cust in the input file. So records for each
master cust should be together with the sequence as above.

I know its a bit complicated to understand. Please let me know if you have some ideas to make it simpler

Thank you
-Manohar
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2237
Location: @my desk

PostPosted: Wed Dec 03, 2008 9:59 am    Post subject:
Reply with quote

Quote:
I know its a bit complicated to understand
Manohar,

You feel that as "a bit"?. One really need to be patient to understand your requirement. What process is generating this file? Is it not possible to enforce these rules while writing the file?

Referring to your 3rd point, if 0222139 was not present as a "Parent Name" for any other records, what would be your 2nd record in output?
Back to top
View user's profile Send private message
manoopatil

New User


Joined: 07 Dec 2003
Posts: 56
Location: Montreal

PostPosted: Wed Dec 03, 2008 9:15 pm    Post subject:
Reply with quote

Hi Arun,

I agree with you that one has to be really patient to understand the requirement. And thank you for taking interest in the post.

The file is getting generated from the SQL query in a program. The changes to the program are going to be costly and hence the option of using SORT or other utility is being explored.

Referring to the 3rd point, if 0222139 was not present as a "Parent Name" in any other records, then following would be 2nd record in the output.

Code:

ACCENURE1 1847709                         ACCENURE1


Please let me know in case of any question

Appreciate your help

Thanks
-Manohar
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us