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: Summing on non-header records

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


Joined: 14 Jul 2006
Posts: 5
Topics: 1

PostPosted: Mon Jun 18, 2007 11:14 am    Post subject: SYNCSORT: Summing on non-header records Reply with quote

Hi,
I have an input rec as follows

ABCD0001
ABCD9999 23928 293293892 23232
ABCD9999 23872 323232323 23232
WXYZ0002
WXYZ0002
WXYZ9999 83223 232322323 23323
WXYZ9999 83223 254545543 23323



In Position 5 thru 8, if it doesnt have '9999', then its a header rec.
I want to sum fields on the last field.
Sometimes, there are duplicate header records, and when I sum fields, I am getting S0c7.

Is there a way in Syncsort to exclude the header record only with summing the fields?
I dont want to eliminate the header record.


Any help would much appreciated.

Thanks!
Joe
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 Jun 18, 2007 11:23 am    Post subject: Reply with quote

joebite,

Try this

Code:

//STEP0200 EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD * 
----+----1----+----2----+----3----+----4                       
ABCD0001                                 
ABCD9999 23928 293293892 23232           
ABCD9999 23872 323232323 23232           
WXYZ0002                                 
WXYZ0002                                 
WXYZ9999 83223 232322323 23323           
WXYZ9999 83223 254545543 23323           
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                         
  SORT FIELDS=(01,09,CH,A)               
  SUM FIELDS=(26,5,ZD)                   
  INREC IFTHEN=(WHEN=(5,4,CH,NE,C'9999'),
       OVERLAY=(26:5C'0'))               
/*


Hope this helps...

Cheers

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 Jun 18, 2007 11:28 am    Post subject: Reply with quote

Kolusu,

I think you need to revert back the Zeroes that you introduced in position (26,5) of header back to Spaces / whatever it was - using OUTREC (after Sorting/summing).


Joebite,

Quote:

Sometimes, there are duplicate header records, and when I sum fields, I am getting S0c7.

Is there a way in Syncsort to exclude the header record only with summing the fields?
I dont want to eliminate the header record.


I have a question here....When you say that you may have duplicate headers, do you really want to retain them as such in the output ?

Kolusu's solution will work fine, but it will remove duplicates in header record (retaining only 1 header / group). Is this acceptable ???

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


Joined: 14 Jul 2006
Posts: 5
Topics: 1

PostPosted: Mon Jun 18, 2007 11:36 am    Post subject: Reply with quote

Thanks Kolusu for the reply.
Just one more favor. If the last rec is Packed Decimal, how does the OVERLAY parms set?

kolusu wrote:
joebite,

Try this

Code:

//STEP0200 EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD * 
----+----1----+----2----+----3----+----4                       
ABCD0001                                 
ABCD9999 23928 293293892 23232           
ABCD9999 23872 323232323 23232           
WXYZ0002                                 
WXYZ0002                                 
WXYZ9999 83223 232322323 23323           
WXYZ9999 83223 254545543 23323           
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                         
  SORT FIELDS=(01,09,CH,A)               
  SUM FIELDS=(26,5,ZD)                   
  INREC IFTHEN=(WHEN=(5,4,CH,NE,C'9999'),
       OVERLAY=(26:5C'0'))               
/*


Hope this helps...

Cheers

Kolusu
Back to top
View user's profile Send private message
joebite
Beginner


Joined: 14 Jul 2006
Posts: 5
Topics: 1

PostPosted: Mon Jun 18, 2007 11:49 am    Post subject: Reply with quote

Hi Phantom,
Yes,retaining only 1 header is acceptable.

Quote:


I have a question here....When you say that you may have duplicate headers, do you really want to retain them as such in the output ?

Kolusu's solution will work fine, but it will remove duplicates in header record (retaining only 1 header / group). Is this acceptable ???

Thanks,
Phantom
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: Mon Jun 18, 2007 11:59 am    Post subject: Reply with quote

JoeBite,

Try this untested sort card
Code:

  INREC IFTHEN=(WHEN=(5,4,CH,NE,C'9999'),
       OVERLAY=(26:3X'0'))               
  SORT FIELDS=(01,09,CH,A)               
  SUM FIELDS=(26,3,PD)                   
  OUTREC IFTHEN=(WHEN=(5,4,CH,NE,C'9999'),
       OVERLAY=(26:3C' ')
/*


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


Joined: 14 Jul 2006
Posts: 5
Topics: 1

PostPosted: Mon Jun 18, 2007 12:03 pm    Post subject: Reply with quote

Hi Phantom,
I am getting S0C7 when I am using X'00' for OVERLAY.
Is there any way to initial packed decimals?

JoeBite

Phantom wrote:
JoeBite,

Try this untested sort card
Code:

  INREC IFTHEN=(WHEN=(5,4,CH,NE,C'9999'),
       OVERLAY=(26:3X'0'))               
  SORT FIELDS=(01,09,CH,A)               
  SUM FIELDS=(26,3,PD)                   
  OUTREC IFTHEN=(WHEN=(5,4,CH,NE,C'9999'),
       OVERLAY=(26:3C' ')
/*


Thanks,
Phantom
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: Mon Jun 18, 2007 12:09 pm    Post subject: Reply with quote

Oops....I'm sorry...forgot to specify the Sign digit for PD (which is very important).

Try changing the INREC OVERLAY to

Code:

     OVERLAY=(26:X'00000C')


Hope this helps,

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


Joined: 14 Jul 2006
Posts: 5
Topics: 1

PostPosted: Mon Jun 18, 2007 12:40 pm    Post subject: Reply with quote

Thanks Phantom...it works!
Thanks again for your inputs and time.

Phantom wrote:
Oops....I'm sorry...forgot to specify the Sign digit for PD (which is very important).

Try changing the INREC OVERLAY to

Code:

     OVERLAY=(26:X'00000C')


Hope this helps,

Thanks,
Phantom
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