DFSORT, sum fields of signed decimal fields

JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

DFSORT, sum fields of signed decimal fields

Postby JorenWillems » Wed Nov 23, 2011 4:39 pm


I have following 5 records in my input file:


I want do sum this fields but I encountered several problem due to the format.

Can someone please help me by writing a good sort to sum this fields?

Posts: 9
Joined: Thu Feb 24, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT, sum fields of signed decimal fields

Postby Frank Yaeger » Wed Nov 23, 2011 11:53 pm

If you just want one output record with the total of the fields, you can use a DFSORT job like the following:

//S1 EXEC PGM=SORT                                               
//SYSOUT DD SYSOUT=*                                             
//SORTIN DD *                                                   
//SORTOUT DD SYSOUT=*                                           
//SYSIN DD *                                                     
  OPTION COPY                                                   
  OUTFIL REMOVECC,NODETAIL,                                     

SORTOUT would have:


If you want something else, you need to do a better job of explaining what you want to do.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Return to JCL


  • Related topics
    Last post