View previous topic :: View next topic
|
Author |
Message |
beto981
New User
Joined: 06 Oct 2006 Posts: 24
|
|
|
|
Hi,
I want to sum all values of a field in a file, using easytrieve. The input file has the following format:
Code: |
FORMAT POS DATA
Z 13 5 150 0000000000001.27081 |
So, I coded this:
Code: |
*--------------------------------------------------------
FILE ARQENT1
ENT1-REG 1 301 A
ENT1-VALUE 150 13 N 5
*--------------------------------------------------------
W-CONTE1 W 14 N
W-CHAVE-1 W 03 A
W-SUM-VAL W 13 N 5
*--------------------------------------------------------
...
...
W-SUM-VAL = W-SUM-VAL + ENT1-VALUE
|
The result was 67,05323, a wrong restult.
Describing ENT1-VALUE and W-SUM-VAL as 13 P 5, I received the error message "*******B097 LENGTH INVALID FOR TYPE - P".
Finally, describing ENT1-VALUE and W-SUM-VAL as 18 N, the result was 782705246961. A correct value, without comma before the last 5 positions.
My question is what I need to do to get this value: 7827052,46961
Tks! |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Might it help to append a MASK to W-SUM-VAL? |
|
Back to top |
|
|
beto981
New User
Joined: 06 Oct 2006 Posts: 24
|
|
|
|
It worked with:
Quote: |
18 N MASK (A '9999999999999.99999') |
Result: 0000007827052.46961
But isn't possible to do this without the mask? How would be the right declaration of the fields?
Tks! |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
beto981 wrote: |
But isn't possible to do this without the mask? How would be the right declaration of the fields? |
IIRC, the MASK value is how you want it displayed when you do not edit it specfiicly....
If you expect to display/print a WS value, add a MASK to it so it it is presentably to you..... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you want this "automatic", use the mask.
You could code multiple moves but this seems like a waste of effort. . .
Why would you not want to use the mask. . .
This was posted hours ago, but was deleted . . . |
|
Back to top |
|
|
|