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

Hi

I have following 5 records in my input file:

+00000052.42
+00000014.48
-00000009.95
+00000009.29
-00000016.04

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?

thx
JorenWillems
 
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

 

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 *                                                   
+00000052.42                                                     
+00000014.48                                                     
-00000009.95                                                     
+00000009.29                                                     
-00000016.04                                                     
//SORTOUT DD SYSOUT=*                                           
//SYSIN DD *                                                     
  OPTION COPY                                                   
  OUTFIL REMOVECC,NODETAIL,                                     
    TRAILER1=(TOT=(1,12,SFF,EDIT=(STTTTTTTT.TT),SIGNS=(+,-)))   
/*


SORTOUT would have:

+00000050.20


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: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post