MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Syncsort Help needed

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
srinivasan_srisailan
Beginner


Joined: 18 May 2004
Posts: 11
Topics: 3

PostPosted: Wed Nov 24, 2004 11:02 pm    Post subject: Syncsort Help needed Reply with quote

Hi all,

My input file is basically an IMS DB unload file. It is a VB file. The first six bytes of the input
file represents the segment name. Every CHILD1 segment record has 4 digit number starting at column 20.
I want to extract only the PARENT segment record and the corresponding the CHILD1 segment record.
The other CHILD segment records are not needed. The condition for extracting is - CHILD1 segment
records with values other than 1111 and 2222 beginning at column 20.

Input file:
Code:
PARENT.....DETAIL1.......
CHILD1.............1111...
CHILD2....................
CHILD3....................
PARENT.....DETAIL2.......
CHILD1.............2222...
CHILD3....................
PARENT.....DETAIL3.......
CHILD1.............3333...
CHILD2....................
CHILD3....................
PARENT.....DETAIL4.......
CHILD1.............4444...
CHILD3....................
PARENT.....DETAIL5.......
CHILD1.............1111...
CHILD2....................
PARENT.....DETAIL6.......
CHILD1.............1111...
CHILD2....................
CHILD3....................


Output file desired:

Code:
PARENT.....DETAIL3.......
CHILD1.............3333...
CHILD2....................
CHILD3....................
PARENT.....DETAIL4.......
CHILD1.............4444...
CHILD3....................


Can this be achieved by SORT or should I go for a COBOL program?
I have SYNCSORT/EASYTRIEVE in my shop. DFSORT is not available.

Thanks,
Srini
Back to top
View user's profile Send private message
srinivasan_srisailan
Beginner


Joined: 18 May 2004
Posts: 11
Topics: 3

PostPosted: Wed Nov 24, 2004 11:37 pm    Post subject: Reply with quote

A small correction in the output file. It should be as specified below:

Code:
PARENT.....DETAIL3.......
CHILD1.............3333...
PARENT.....DETAIL4.......
CHILD1.............4444...


Please suggest a solution.

Thanks,
Srini
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Nov 25, 2004 1:25 am    Post subject: Reply with quote

Srinivasan,

Please give us the following info.

1. Will a parent ALWAYS have 3 child segments ?
2. Is there a way to Identify a PARENT segment. Does it start with 'PARENT' or is it just an example ?
3. You said ur output is of VB type. Can there be any record with LRECL less than 20 ?

Thanks,
Phantom
Back to top
View user's profile Send private message
srinivasan_srisailan
Beginner


Joined: 18 May 2004
Posts: 11
Topics: 3

PostPosted: Thu Nov 25, 2004 12:23 pm    Post subject: Reply with quote

Phantom,

Here are the answers:

1. No the parent need not have 3 child segment records. For Ex: it can also be without a CHILD1 segment record.

2. Yes the PARENT segment can be identified with the word 'PARENT'.

3. The input file is a VB file. A CHILD1 segment record will always have LRECL greater than 24. But the other CHILD segment records can have LRECL < 20.

I have missed out one more condition, there can be more than one CHILD1 segment records within a PARENT segment record.

I hope the requirements are clear.

Thanks,
Srini
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sun Nov 28, 2004 9:35 pm    Post subject: Reply with quote

srinivasan_srisailan,

Try to customize the solution posted by me in this thread ( 5th post from the bottom)

http://www.mvsforums.com/helpboards/viewtopic.php?t=1850

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Nov 29, 2004 12:38 am    Post subject: Reply with quote

Kolusu,

Is there a traditional way to solve this problem without using SPLICE? I could not think of any. The problem is easy to solve if the no. of child1 records does not vary.

Srinivasan,

Kolusu's solution (in the link) requires latest version of Syncsort to support SPLICE. What version of Syncsort do you have at your shop ?

Kolusu,
I could rearrange the records in this order. I dont know how to proceed further. Let me know if you get an idea (without SPLICE).

Input:
Code:

PARENT.....DETAIL1....... 
CHILD1.............1111...
CHILD1.............3333   
CHILD1.............5555   
CHILD3....................
PARENT.....DETAIL2....... 
CHILD1.............2222...
CHILD3....................
PARENT.....DETAIL3....... 
CHILD1.............3333...
CHILD2....................
CHILD3....................
PARENT.....DETAIL4....... 
CHILD1.............4444...
CHILD3....................
PARENT.....DETAIL5....... 
CHILD1.............1111...
CHILD2....................
PARENT.....DETAIL6....... 
CHILD1.............1111...
CHILD2....................


Output:
Code:

PARENT.....DETAIL1.......
CHILD1.............3333   
CHILD1.............5555   
PARENT.....DETAIL2.......
PARENT.....DETAIL3.......
CHILD1.............3333...
PARENT.....DETAIL4.......
CHILD1.............4444...
PARENT.....DETAIL5.......
PARENT.....DETAIL6.......


Now I need to remove the PARENT records if it has no sub-ordinate CHILDs following it. In the above case I need to delete PARENT-DETAIL2 & PARENT-DETAIL5. Can you think of a way to do this using the OLD Syncsort ? (that I have !!!)

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Nov 29, 2004 6:34 am    Post subject: Reply with quote

phantom,

I don't think there is a way to solve this with the traditional features available in sort. If I find out a way I will let you know

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
srinivasan_srisailan
Beginner


Joined: 18 May 2004
Posts: 11
Topics: 3

PostPosted: Tue Nov 30, 2004 2:14 am    Post subject: Reply with quote

Phantom,

SYNCSORT in my shop doesn't support SPLICE Sad .

I was able to get the same output as you had obtained with SORT but couldn't proceed further. So I finally wrote a COBOL program to achieve this. Still wondering if there's a SORT solution to achieve this Question .

Thanks Phantom and Kolusu.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group