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 

Dropping summary records
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
wiprov
Beginner


Joined: 18 May 2010
Posts: 7
Topics: 1

PostPosted: Sat Sep 27, 2014 11:06 pm    Post subject: Dropping summary records Reply with quote

Hi,

I have an input file, with 3 groups and each group has header and detail records.
LREC=10, RECFM=FB

First byte -'H' indicator header record. Detail records
are indicated by either '5' or '6' in the first byte.
Code:

H1
5XXXA
6XXXB
6XXXC

H4
5YYY1
5YYY2
6YYY3

H1
5MMMA
6MMMB
6MMMC

In the i/p file, header record H1 is getting repeated (even though it contains different detail records)

The requirement is to drop the group records, if the header is duplicate.
(picking only the first occurrence of H1 summary records)
Expected o/p file is :
Code:

H1
5XXXA
6XXXB
6XXXC

H4
5YYY1
5YYY2
6YYY3

Can you please let me know, if this can be achieved in SORT.
Kindly let me know, if you need any further info. Many thanks in advance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Sep 28, 2014 8:48 am    Post subject: Reply with quote

wiprov,

use the following UNTESTED which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                       
H1                                                                   
5XXXA                                                                 
6XXXB                                                                 
6XXXC                                                                 
H4                                                                   
5YYY1                                                                 
5YYY2                                                                 
6YYY3                                                                 
H1                                                                   
5MMMA                                                                 
6MMMB                                                                 
6MMMC                                                                 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'H'),PUSH=(11:1,10,ID=8))
  SORT FIELDS=(11,10,CH,A),EQUALS                 
                   
  OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(11,10),PUSH=(30:21,8))         
  OUTFIL BUILD=(1,10),OMIT=(21,8,CH,NE,30,8,CH)                       
//*                                                                   

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


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Sun Sep 28, 2014 12:25 pm    Post subject: Reply with quote

wiprov,

In the other place where you posted, you showed headers "out of sequence" on input and output. Which sample data is representative?
Back to top
View user's profile Send private message
wiprov
Beginner


Joined: 18 May 2010
Posts: 7
Topics: 1

PostPosted: Tue Sep 30, 2014 12:49 pm    Post subject: Reply with quote

Hi,
Sorry, I should have been more clear in my example . Sad ... Crying or Very sad
My intention is to remove the group, if it contains duplicate header. Slightly modifying my input and sorry again
Code:

H4                                                                   
5XXXA                                                                 
6XXXB                                                                 
6XXXC                                                                 
H1                                                                   
5YYY1                                                                 
5YYY2                                                                 
6YYY3
H4                                                                   
5QQQA                                                                 
6QQQB                                                                 
6QQQC                                                                 
H3                                                                   
5MMMA                                                                 
6MMMB                                                                 
6MMMC
H1                                                                   
5NNN1                                                                 
5NNN2                                                                 
6NNN3

Header H1 and H4 are duplicates in this i/p and that has to be removed..

Expected o/p:
Code:

H4                                                                   
5XXXA                                                                 
6XXXB                                                                 
6XXXC                                                                 
H1                                                                   
5YYY1                                                                 
5YYY2                                                                 
6YYY3                                                                 
H3                                                                   
5MMMA                                                                 
6MMMB                                                                 
6MMMC

Your thoughts please....Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Sep 30, 2014 1:24 pm    Post subject: Reply with quote

wiprov wrote:
Your thoughts please....Thanks


Did you bother running the job I gave you earlier? If so what did you get?

Do you need to retain the Order of the Input records? Once you sort the H1 header group will be the first group.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
wiprov
Beginner


Joined: 18 May 2010
Posts: 7
Topics: 1

PostPosted: Tue Sep 30, 2014 9:22 pm    Post subject: Reply with quote

Yes Kolusu, I have executed the code and it has thrown the below syntax error . Sad



Code:
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(11,10),PUSH=(30:21,8))
                         *
SYNTAX ERROR.



I feel, it is not recognizing KEYBEGIN as it might not have supported in our old version.

By the way, i am sorry for the delay in my response. We could not open this site in our office, and hence i have to come out of office premises to post my response. Sad
Back to top
View user's profile Send private message
wiprov
Beginner


Joined: 18 May 2010
Posts: 7
Topics: 1

PostPosted: Tue Sep 30, 2014 10:47 pm    Post subject: Reply with quote

And yes, we have to retain the order of i/p records. Thanks
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Wed Oct 01, 2014 1:05 am    Post subject: Reply with quote

Perhaps you can show us your DFSORT version by pasting the full sysout with that error in it, please? We don't want to produce (more) code which will not work for you.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Oct 01, 2014 11:34 am    Post subject: Reply with quote

wiprov wrote:
Yes Kolusu, I have executed the code and it has thrown the below syntax error . Sad



Code:
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(11,10),PUSH=(30:21,8))
                         *
SYNTAX ERROR.



I feel, it is not recognizing KEYBEGIN as it might not have supported in our old version.

By the way, i am sorry for the delay in my response. We could not open this site in our office, and hence i have to come out of office premises to post my response. Sad


Wiprov,

Good job of not showing the error message prefix. I would really appreciate if you can be clear about the product your shop has. Just so know you would have got an OPERAND DEFINER ERROR and not a syntax error on the KEYBEGIN keyword.

Code:

            OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(11,10),PUSH=(30:21,8))     
                                      $                                     
ICE006A 0 OPERAND DEFINER ERROR                                             
            OUTFIL BUILD=(1,10),OMIT=(21,8,CH,NE,30,8,CH) 

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


Joined: 18 May 2010
Posts: 7
Topics: 1

PostPosted: Wed Oct 01, 2014 11:59 am    Post subject: Reply with quote

When running the job, i came to know we are using SYNCSORT tool..Sad
Sorry that, i couldn't post the complete error message as all the external websites are blocked (noted in a paper and posted here).
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Oct 01, 2014 12:20 pm    Post subject: Reply with quote

wiprov,

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I can't answer questions on Syncsort.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Wed Oct 01, 2014 7:18 pm    Post subject: Reply with quote

If you add a sequence number, you can RESTART=(11,10) and BEGIN on the sequence number being one.
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Fri Oct 03, 2014 1:15 am    Post subject: Reply with quote

wiprov, can you ask in one place and stick to one place, please?

Did you try with the RESTART on a sequence number? Then you can say "yes, that gives the correct output, but the order is wrong and we can't have that" so you need to add another sequence number, and a second SORT.
Back to top
View user's profile Send private message
wiprov
Beginner


Joined: 18 May 2010
Posts: 7
Topics: 1

PostPosted: Fri Oct 03, 2014 10:55 am    Post subject: Reply with quote

I am very sorry, will stick here.
Could you please provide me the sample code? Thanks in advance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Oct 03, 2014 11:46 am    Post subject: Reply with quote

wiprov wrote:
I am very sorry, will stick here.
Could you please provide me the sample code? Thanks in advance.


Wiprov,

The code is right in front of you. You need to understand what the job is doing and if you did you would have the solution by now.

1.You are getting an error on the KEYBEGIN statement, so look at the INREC statement and see how you can modify the OUTREC similar to that.

2. Change your OUTFIL to lrecl(which is alreay coded) and add the contents of ID which contains the sequence of records in your input that you added using INREC.

3. Code another SORT step to retain the order of the records with SORT FIELDS= the contents you added at the end from step 2 OUTFIL with EQUALS option.

4. Code an OUTREC statement to remove the temp sequence number and you will get the desired results.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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