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

Easytrieve - Sum of values


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
beto981

New User


Joined: 06 Oct 2006
Posts: 24

PostPosted: Fri Jul 02, 2010 1:44 am
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Fri Jul 02, 2010 1:55 am
Reply with quote

Might it help to append a MASK to W-SUM-VAL?
Back to top
View user's profile Send private message
beto981

New User


Joined: 06 Oct 2006
Posts: 24

PostPosted: Fri Jul 02, 2010 2:13 am
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jul 02, 2010 4:53 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 02, 2010 6:11 am
Reply with quote

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 . . . icon_evil.gif
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Count the number of characters in a f... CA Products 1
Search our Forums:

Back to Top