IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Summation of Hexadecimal value using sort


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 09, 2015 2:38 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top