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 

Ignore Cents in Amount During SUM in SORT

 
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 02, 2013 10:39 am    Post subject: Ignore Cents in Amount During SUM in SORT Reply with quote

this is current sort syntax
Code:

SORT FIELDS=COPY
INCLUDE COND=((01,2,CH,EQ,C'20'),
          AND,(20,2,BI,EQ,02),
          AND,(22,2,BI,EQ,2012),
          AND,(24,3,CH,EQ,C'030'))
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('GROSS PRM= ',TOT=(035,8,PD,EDIT=(TTTTTTTTTTTTTTT.TT)), +
          'ORIG GROS= ',TOT=(043,8,PD,EDIT=(TTTTTTTTTTTTTTT.TT)))


is it possible to change this so the cents columns are not being added.
the reason i ask- when we load to a particular database it doesnt add the cents. i am trying to match the two numbers and of course they are off because of the cents.
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 02, 2013 11:57 am    Post subject: Reply with quote

newcobol,

Just divide the number by 100 (assuming 2 decimals as cents) and you will have a whole number . Add this to your code.

Code:

OUTREC OVERLAY=(35:35,8,PD,DIV,+100,PD,LENGTH=8, 
                43:43,8,PD,DIV,+100,PD,LENGTH=8) 
                                                 

_________________
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 02, 2013 3:33 pm    Post subject: Reply with quote

if you divide by 100 it will round the number up i think? i want to drop the cents altogether. is this possible?
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Dec 02, 2013 3:35 pm    Post subject: Reply with quote

Did you try the code as suggested? If not, why not.

Probably best not to challange the developer without testing first . . .
_________________
All the best,

di
Back to top
View user's profile Send private message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Dec 02, 2013 3:43 pm    Post subject: Reply with quote

i tried it, i pasted the two lines at the end of my code, and it was close but still did not match what we loaded into the database. and the result of the sort was still a number with a decimal point and cents
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Dec 02, 2013 4:14 pm    Post subject: Reply with quote

Quote:
and the result of the sort was still a number with a decimal point and cents

because that is what your edit mask specifies.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
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 02, 2013 5:29 pm    Post subject: Reply with quote

newcobol wrote:
i tried it, i pasted the two lines at the end of my code, and it was close but still did not match what we loaded into the database. and the result of the sort was still a number with a decimal point and cents


As Nic Clouston pointed out your edit mask is showing the cents value but the PD format does not have any cents.

When you say it does not match you need to show us a few examples of input data and show how the sort sum is calculating it incorrectly.
_________________
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: Tue Dec 03, 2013 11:23 am    Post subject: Reply with quote

this is what i have after i added the two lines as suggested:

Code:

SORT FIELDS=COPY
INCLUDE COND=((01,2,CH,GT,C'19'),
          AND,(20,2,BI,EQ,02),
          AND,(22,2,BI,EQ,2012))
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('GROSS PRM= ',TOT=(035,8,PD,EDIT=(TTTTTTTTTTTTTTT.TT)), +
          'ORIG GROS= ',TOT=(043,8,PD,EDIT=(TTTTTTTTTTTTTTT.TT)))
OUTREC OVERLAY=(35:35,8,PD,DIV,+100,PD,LENGTH=8,
                43:43,8,PD,DIV,+100,PD,LENGTH=8)


what do i change
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: Tue Dec 03, 2013 11:44 am    Post subject: Reply with quote

newcobol,

Just remove the decimal dot in your edit mask on the trailer parm.

Code:

  OUTFIL REMOVECC,NODETAIL,                                       
  TRAILER1=('GROSS PRM= ',TOT=(035,8,PD,EDIT=(TTTTTTTTTTTTTTTTT)),
            'ORIG GROS= ',TOT=(043,8,PD,EDIT=(TTTTTTTTTTTTTTTTT)))


I am not sure why you have + Sign at the end, just so you know it is treated as a comment and is ignored. If your intention is to add both fields and then perform a sum then you need to do that using inrec/outrec
_________________
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: Tue Dec 03, 2013 1:09 pm    Post subject: Reply with quote

it made the number 100 times bigger.
39520390.21ORIG GROS= 000003753774396.01 srtsum5t
3952039021 ORIG GROS= 00000375377439601 with . removed.
Back to top
View user's profile Send private message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Tue Dec 03, 2013 5:28 pm    Post subject: Reply with quote

it appears my numbers on the loaded database match the output of my sortsums.
thank you.
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: Tue Dec 03, 2013 6:05 pm    Post subject: Reply with quote

newcobol wrote:
it appears my numbers on the loaded database match the output of my sortsums.
thank you.


So the proposed Divide by 100 worked? What were the intermediate results you are showing that you thought wasn't working?
_________________
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: Wed Dec 04, 2013 10:30 am    Post subject: Reply with quote

the numbers i got from database people were sent with 2 digits missing
Back to top
View user's profile Send private message
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