View previous topic :: View next topic
|
Author |
Message |
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Is this okay?
Code: |
SUM FIELDS=(30,8,BI) |
|
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
|