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 BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm


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