How to sum sign values



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to sum sign values

Postby ykreddy » Thu Feb 10, 2011 5:46 pm

Hi All,

I have an input file with values of

ykreddy -100000
gkreddy +000100
ykreddy -200000
gkreddy -400000


I want to sum these values
like

ykreddy -300000
gkreddy -399900


Can any one help me please...
Thanks & Regards,

YK Reddy
ykreddy
 
Posts: 6
Joined: Mon Sep 20, 2010 5:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to sum sign values

Postby Frank Yaeger » Fri Feb 11, 2011 12:07 am

Here's a DFSORT job that will do what you asked for. I assumed it was ok to have the output records sorted by the first field.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ykreddy  -100000
gkreddy  +000100
ykreddy  -200000
gkreddy  -400000
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  SORT FIELDS=(1,9,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,9,
      TRAILER3=(1,9,
         TOT=(10,7,FS,EDIT=(STTTTTT),SIGNS=(+,-))))
/*


SORTOUT would have:

gkreddy  -399900 
ykreddy  -300000 


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 DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post