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
 

 

Summation of Hexadecimal value using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
pvkmainframes

New User


Joined: 08 Sep 2015
Posts: 1
Location: USA

PostPosted: Wed Sep 09, 2015 12:48 am    Post subject: Summation of Hexadecimal value using sort
Reply with quote

Hi Team,
I am new to this forum. I have one requirement to sum the Hexadecimal value and dispaly in Trailer record. I am trying different options in syncsort, but result is not expected one. can you plese help on this.

Input data:: we are getting this file from cobol program in cobol this varibale is declared as a comp-2.

Data appers in below format when we use copybook.

-8.005000000000000E+02
-8.005000000000000E+02
-8.005000000000000E+02
-8.005000000000000E+02
-8.005000000000000E+02

sort card

Code:

SORT FIELDS=COPY                                 
OUTFIL REMOVECC,                                 
TRAILER1=(1:C'TOTAL',6:TOT=(1,8,FL,SIGNS=(+,-)))


actual output should be:: -4002.50
sot JCL giving the output :: 4000-

i tried using EDIT parm in the sort like EDIT=(SIIIIIIIIIIIIIIT.TT), but if input changes it is not giving correct value.

Can you please suggest how to solve this issue. Plese let me know if you need any other details and also correct me if anything wrong in this post.

Thanks,PV
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Sep 09, 2015 2:38 am    Post subject: Reply to: Summation of Hexadecimal value using sort
Reply with quote

If your data contains a floating-point value (in COBOL, COMP-1 or COMP-2, or even longer than those) then FL is only going to get you the integer part of that.

If you need it in SORT, you'll have to arrange an EXIT program to do a conversion which would have a defined number of decimal places. Or just do it in a general-purpose programming language if you don't need other parts of SORT's capabilities for the task.

The code you show is behaving exactly as it should. It cannot behave as you want. If you want to moan about it, take it up with SyncSORT, not here.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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