Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT field and Sum field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sreelatha16

New User


Joined: 26 Jun 2008
Posts: 2
Location: bnglore

PostPosted: Fri Jun 27, 2008 7:17 pm    Post subject: SORT field and Sum field
Reply with quote

Hi

I have 2 colums in my table 1) job id and 2)salary

Note : job id's are not unique
I need to sort job id in ascending order and give the sum of the salaries relating to the same job id

Please help me out
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 27, 2008 8:45 pm    Post subject:
Reply with quote

Hello,

Please look in the forum for a proper way to post your question. There are many examples similar to what you want to do in the JCL and DFSORT sections of the forum.

Do you really mean a "table" or is your input a sequential file?

Which sort product is used on your system?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Jun 27, 2008 9:15 pm    Post subject:
Reply with quote

Hi,

To fetch good answer for any SORT problem, the best way is to show the input with some sample records & expected output, with their LRECL & RECFM.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Fri Jun 27, 2008 9:46 pm    Post subject:
Reply with quote

Here is a simple example which you can modify to suit your actual data:
Code:

//SORT   EXEC PGM=SORT                               
//SORTOUT DD  SYSOUT=*                               
//SORTIN  DD *                                       
123 61000                                           
456 38000                                           
123 35000                                           
789 80000                                           
456 56000                                           
//SYSOUT  DD  SYSOUT=*                               
//SYSIN   DD *             
   SORT FIELDS=(1,3,ZD,A)   
   SUM FIELDS=(5,5,ZD)     
/*                         

This is the output produced form the above example:
Code:
123 96000           
456 94000           
789 80000           
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us