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

summing s9(8)v99 COMP field


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

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Thu Apr 17, 2008 5:46 pm
Reply with quote

Hi,

I have a field defined as S9(8)V99 Comp defined in copybook (starting pos 30, ending at 37. It is occupying 8 bytes. I want to sum this field for each document no which is stored in pos 1 to 21 char.

When i view the fields in fileaid, it shows it has both positive and negative values. When i gave SUM FIELDS=(30,8,ZD), it sums positive values but leaves negative ones.

Thanks,
Ajay
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Thu Apr 17, 2008 5:52 pm
Reply with quote

Is this okay?
Code:
SUM FIELDS=(30,8,BI)
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 17, 2008 6:39 pm
Reply with quote

Ajay Baghel wrote:
I have a field defined as S9(8)V99 Comp defined in copybook (starting pos 30, ending at 37. It is occupying 8 bytes. I want to sum this field for each document no which is stored in pos 1 to 21 char.

When i view the fields in fileaid, it shows it has both positive and negative values. When i gave SUM FIELDS=(30,8,ZD), it sums positive values but leaves negative ones.
Using sort to sum?
I'm suprised that the whole thing didn't just abend. ZD is zoned decimal, COMP is binary.
Please post your JCL, sysouts and an example of your input and expected output.

gnanas,
BI is unsigned binary, FI is signed binary and would be a better choice... take a look at Appendix C and DFSORT Data Formats
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Fri Apr 18, 2008 5:57 am
Reply with quote

My mistake, sorry in typing...

My sort card has belwo SUM statement

SORT FIELDS=(1,21,CH)
SUM FIELDS=(30,8,BI)

it sums positive values but leaves negative ones.




I tried
-Ajay
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 18, 2008 6:08 am
Reply with quote

Ajay Baghel wrote:
SORT FIELDS=(1,21,CH)
SUM FIELDS=(30,8,BI)
it sums positive values but leaves negative ones.
Simple, if you would look at the DFSORT Data Formats you would have found that BI is binary unsigned and what you need is FI, basically binary signed....
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top