shell100
New User
Joined: 14 Apr 2006 Posts: 25 Location: Banglore,India
|
|
|
|
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 |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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)
|
|
|