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 

Summation based on the fields using SORT/ICETOOL

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


Joined: 29 Jun 2004
Posts: 11
Topics: 8
Location: Bangalore

PostPosted: Thu Oct 18, 2007 3:40 pm    Post subject: Summation based on the fields using SORT/ICETOOL Reply with quote

Hi Friends,

I have a requirement like below

Say my input file is like below. I want to sum the numbers for A,B,C..

A X 100
B Y 080
A Z 090
C S 025
B V 010

I want my out put file like below (The numbers summed)

A 190
B 090
C 025

Could you please guide me regarding the same.
_________________
Regards,
Vishwakiran
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Thu Oct 18, 2007 11:54 pm    Post subject: Reply with quote

Vishwakiran
This SORT JOB does what you want.
Code:
//*******************************************************               
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
A X 100                                                                 
B Y 080                                                                 
A Z 090                                                                 
C S 025                                                                 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
B V 010                                                                 
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
           SORT FIELDS=(1,1,CH,A)                                       
           SUM FIELDS=(5,3,ZD)                                         
           OUTREC BUILD=(1,1,3:5,3)                                     
/*                                                                     

SORTOUT
Code:
A 190   
B 090   
C 025   

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 19, 2007 10:15 am    Post subject: Reply with quote

Vishwakiran,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
A X 100
B Y 080
A Z 090
C S 025
B V 010
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION ZDPRINT
  SORT FIELDS=(1,1,CH,A)
  SUM FIELDS=(5,3,ZD)
/*


krisprems,

The OUTREC statement isn't needed (I'm curious as to why you think it is).

Also, it's best to specify the ZDPRINT option in case it isn't the default.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 10:19 am    Post subject: Reply with quote

Frank
Since you wont use the OUTREC in your SORT JCL your o/p would look like
Code:
A X 190     
B Y 090     
C S 025     

where as the Vishwakiran wants inthis format
Code:
A 190
B 090
C 025

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 19, 2007 10:30 am    Post subject: Reply with quote

Oh, I see. I missed that. Embarassed
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 10:33 am    Post subject: Reply with quote

Quote:
Oh, I see. I missed that.

No problem, i miss hundred and one things and you come back with corrections, me giving you extra work. bonk
_________________
cHEERs
krisprems
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