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
 

 

Easytrieve - Sum of values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Easytrieve - Sum of values
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: 2150
Location: At my coffee table

PostPosted: Fri Jul 02, 2010 1:55 am    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Jul 02, 2010 4:53 am    Post subject:
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

Site Director


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

PostPosted: Fri Jul 02, 2010 6:11 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am


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