MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Summing display data with decimal point in field

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Dec 09, 2013 4:14 pm    Post subject: Summing display data with decimal point in field Reply with quote

This is part of the file layout:

Code:

  ****  Top of data  ****
1 1 WS-OUT-REC                                        AN      1    489    489
2  2 WS-FIL1                                X(01)     AN      1      1      1
3  2 WS-SOURCE-CD                           X(02)     AN      2      3      2
4  2 WS-FIL2                                X(03)     AN      4      6      3
5  2 WS-PROD-NO                             X(09)     AN      7     15      9
6  2 WS-FIL3                                X(03)     AN     16     18      3
7  2 WS-LAST-TRAN-CD                        X(01)     AN     19     19      1
8  2 WS-FIL5                                X(02)     AN     20     21      2
9  2 WS-ACCT-QTR                            9(4)      ZD     22     25      4
0  2 WS-FIL6                                X(01)     AN     26     26      1
1  2 WS-ACCT-YR                             9(4)      ZD     27     30      4
2  2 WS-FIL7                                X(02)     AN     31     32      2
3  2 WS-REPORTNG-BRANCH                     X(03)     AN     33     35      3
4  2 WS-FIL8                                X(03)     AN     36     38      3
5  2 WS-PRODUCNG-BRANCH                     X(03)     AN     39     41      3
6  2 WS-FIL9                                X(03)     AN     42     44      3
7  2 WS-CURRENCY-CODE                       X(03)     AN     45     47      3
8  2 WS-FIL10                               X(03)     AN     48     50      3
9  2 WS-REG-PRODUCNG                        X(02)     AN     51     52      2
0  2 WS-FIL11                               X(02)     AN     53     54      2
1  2 WS-GROSS-PRM-AMT                                 AN     55     71     17
2   3 WS-GROSS-PRM-AMT-B4DEC                X(14)     AN     55     68     14
3   3 WS-DECIMAL-GROSS                      X(01)     AN     69     69      1
4   3 WS-GROSS-PRM-AMT-AFDEC                X(02)     AN     70     71      2
5  2 WS-FIL12                               X(01)     AN     72     72      1
6  2 WS-ORIG-GROSS-PRM                                AN     73     89     17
7   3 WS-ORIG-GROSS-PRM-B4DEC               X(14)     AN     73     86     14
8   3 WS-DECIMAL-GROSS-ORIG                 X(01)     AN     87     87      1
9   3 WS-ORIG-GROSS-PRM-AFDEC               X(02)     AN     88     89      2
0  2 WS-FIL13                               X(01)     AN     90     90      1
1  2 WS-COMM-PRM-AMT                                  AN     91    107     17

i want to sum the ws-gross-prm-amt field
and the ws-orig-gross-prm field(2 separate totals)

I am starting with something like this but not sure what to change or if I am doing it right. and yes i have looked at the manual but not clear to me
Back to top
View user's profile Send private message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Dec 09, 2013 4:15 pm    Post subject: Reply with quote

Code:

//SYSIN    DD *
   SORT FIELDS=COPY
   OUTFIL REMOVECC,NODETAIL,
   TRAILER1=('GROSS PRM= ',TOT=(055,17,SFF,EDIT=(SIIIIIIIIIIIIII.TT)),
             'ORIG GROS= ',TOT=(073,17,SFF,EDIT=(SIIIIIIIIIIIIII.TT)))
/*
//
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Dec 09, 2013 4:30 pm    Post subject: Reply with quote

newcobol,

Your control cards looks ok, aren't you getting the desired results?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Dec 09, 2013 4:33 pm    Post subject: Reply with quote

well it ran with code 0, the numbers just seem way off from the file it is reading
Back to top
View user's profile Send private message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Dec 09, 2013 4:51 pm    Post subject: Reply with quote

yes it appears to be working fine. it puts an s in front of the number but no harm no foul
Back to top
View user's profile Send private message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Dec 09, 2013 5:09 pm    Post subject: Reply with quote

now is there a way to not add the cents up with this file format?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Dec 09, 2013 5:43 pm    Post subject: Reply with quote

newcobol wrote:
yes it appears to be working fine. it puts an s in front of the number but no harm no foul


newcobol,

You have coded the edit mask but did not specify the SIGNS keyword so that it can write + or - after totaling. Edit masks let you derive your own pattern and hence you need to define the rules for S. Since you did not code the SIGNS keyword it is treated as a literal.

So use the following control cards

Code:

//SYSIN    DD *
   SORT FIELDS=COPY
   OUTFIL REMOVECC,NODETAIL,
   TRAILER1=('GROSS PRM= ',
             TOT=(055,17,SFF,EDIT=(SIIIIIIIIIIIIII.TT),SIGNS=(,-)),
             'ORIG GROS= ',
             TOT=(073,17,SFF,EDIT=(SIIIIIIIIIIIIII.TT),SIGNS=(,-)))
/*


newcobol wrote:
now is there a way to not add the cents up with this file format?


The same technique suggested in your earlier topic.

http://www.mvsforums.com/helpboards/viewtopic.php?p=59542#59542

But you now you just need to convert the SFF format to PD first before dividing it by 100. So use the following control cards. I removed the decimal points in your edit mask and also changed your sign to be at the end instead of beginning

Code:

//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC OVERLAY=(55:55,17,SFF,PD,LENGTH=10,7X,                         
                 73:73,17,SFF,PD,LENGTH=10,7X)                         
                                                                       
  OUTREC OVERLAY=(55:55,10,PD,DIV,+100,PD,LENGTH=10,                   
                  73:73,10,PD,DIV,+100,PD,LENGTH=10)                   
                                                                       
  OUTFIL REMOVECC,NODETAIL,                                             
  TRAILER1=('GROSS PRM= ',                                             
            TOT=(55,10,PD,EDIT=(IIIIIIIIIIIIIIITS),SIGNS=(,,,-)),       
            'ORIG GROS= ',                                             
            TOT=(73,10,PD,EDIT=(IIIIIIIIIIIIIIITS),SIGNS=(,,,-)))       
/*                                                                     

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group