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

To sum binary datatype


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shell100

New User


Joined: 14 Apr 2006
Posts: 25
Location: Banglore,India

PostPosted: Wed Jun 18, 2008 1:58 pm
Reply with quote

Need some help to do sum on binary datatype.
I am using file which need to be sort on 2 fields & sum on 1 field.

Sample :

SORT FIELDS=(1,25,CH,A,26,10,ZD,A)
SUM FIELDS=(35,4,BI)

X(PIC X(25)
Y (PIC 9(10))
Z (PIC S9(9) COMP)

I am not able to achieve sum with records having +positive & -negative value both for variable Z.

For ex : I have input file as
INDIA, 1234567891, -10
INDIA, 1234567891, 10
INDIA, 1234567891, -10
INDIA, 1234567891, 10

Required o/p should be as
INDIA, 1234567891, 0

But it is coming same as I/P file.

It would be great if you could give some pointer to resolve this ?

Shell
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jun 18, 2008 8:35 pm
Reply with quote

Hello,

The data posted does not begin with an x(25) field?

The SUM FIelds begins in 35?

Please show a few records in hex (using the "Code" tab to preserve alignment).
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Jun 18, 2008 9:16 pm
Reply with quote

Shell,

BI is unsigned binary so you can't use it to sum + and - values. You can use FI to sum + and - values. Try:

Code:

   SUM FIELDS=(35,4,FI)
Back to top
View user's profile Send private message
shell100

New User


Joined: 14 Apr 2006
Posts: 25
Location: Banglore,India

PostPosted: Thu Jun 19, 2008 6:37 pm
Reply with quote

Thanks!!

It worked with FI.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary to display characters SYNCSORT 3
No new posts Select numeric portion from CHAR data... DB2 6
No new posts Check Binary Values for symbols CA Products 3
No new posts resume binary ftp in z/os All Other Mainframe Topics 6
No new posts Casting a Binary Number to Numeric in... Java & MQSeries 6
Search our Forums:

Back to Top