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 

Total value of all records in Sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
kishore_gk
Beginner


Joined: 23 Jul 2003
Posts: 12
Topics: 8

PostPosted: Fri Jan 23, 2004 6:30 am    Post subject: Total value of all records in Sort Reply with quote

Hi All,

Pls suggest me some thing to acheive the folloinwg..

I want to add certain numbers in a file and display the total at the end of fiie by using SORT utility.

Ex:
Input file :
1
2
3
4
5

Output File:

1
2
3
4
5

15 (This is total of the numbers)

Thank you
_________________
kishore
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 23, 2004 6:49 am    Post subject: Reply with quote

kishore,

The following JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
1                                                             
2                                                             
3                                                             
4                                                             
5                                                             
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD    *                                             
  SORT FIELDS=COPY                                             
  OUTFIL REMOVECC,                                             
      TRAILER1=('TOTAL OF ALL NUMBERS:',TOTAL=(1,1,ZD,M10),80:X)
/*                                                             


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
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Fri Jun 11, 2004 5:01 am    Post subject: Reply with quote

Hi Kolusu,

I tried to add the Decimal values by using syncsort but it's giving S0C7.
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jun 11, 2004 5:30 am    Post subject: Reply with quote

Chandra,

Please search before posting. For summing fields with embedded with decimal point you need to process differently. check this link.

http://www.mvsforums.com/helpboards/viewtopic.php?t=63&highlight=decimal

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
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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