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
 

 

Ignore sign while adding values using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Fri Nov 24, 2006 3:06 pm    Post subject: Ignore sign while adding values using DFSORT
Reply with quote

Hi,

Is there is any way to add the values in afile using JCL by ignoring the sign.

eg. i have a file with foll values

Code:

192BI             -4.10
192PD             -2.73
192UM            -65.47
211CC             21.40
211CL             64.89


if we add this using sort utility i will get sum as 13.99
instead of that i should get as 158.59

i mean it should ignore sign.despite og whether it is -ve or +ve it should add total of them
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 3:42 pm    Post subject:
Reply with quote

That should be simple...

Use INREC to overlay the "-" and sumerize as normal.

Download Frank's Smart DFSORT Tricks at:
http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Nov 24, 2006 9:31 pm    Post subject:
Reply with quote

You can use DFSORT's UFF format to get absolute values of signed numbers with decimal points. Here's a DFSORT job that will total the values:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
192BI             -4.10
192PD             -2.73
192UM            -65.47
211CC             21.40
211CL             64.89
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
   TRAILER1=(/,'Total',
      15:TOT=(15,9,UFF,EDIT=(IIIIIT.TT)))
/*


SORTOUT will have:

Code:

192BI             -4.10   
192PD             -2.73   
192UM            -65.47   
211CC             21.40   
211CL             64.89   
                           
Total            158.59   


Quote:
Use INREC to overlay the "-" and sumerize as normal.


You can't use SUM for values with a decimal point. You would have to use UFF or SFF format to remove the decimal point and convert to ZD, sum the ZD values and then convert back. TRAILER with TOT is easier.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


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