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
 

 

summing s9(8)v99 COMP field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

PostPosted: Thu Apr 17, 2008 5:46 pm    Post subject: summing s9(8)v99 COMP field
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: 785
Location: Chennai, India

PostPosted: Thu Apr 17, 2008 5:52 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 17, 2008 6:39 pm    Post subject: Re: summing s9(8)v99 COMP field
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: 205
Location: Bangalore

PostPosted: Fri Apr 18, 2008 5:57 am    Post subject: Reply to: summing s9(8)v99 COMP field
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: 2150
Location: At my coffee table

PostPosted: Fri Apr 18, 2008 6:08 am    Post subject: Re: Reply to: summing s9(8)v99 COMP field
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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