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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm


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