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
 

 

Is it possible to round 9th decimal point in COBOL?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vinuk2009

New User


Joined: 30 Apr 2009
Posts: 19
Location: chennai

PostPosted: Wed Jun 09, 2010 9:29 pm    Post subject: Is it possible to round 9th decimal point in COBOL?
Reply with quote

Hi,

Is it possible to round 9th decimal point while dividing values.

if the output of two values divide function is .093989466 that output value I want as .093989470 and if output is .093989464 that output value I want as .093989464.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7935
Location: Bellevue, IA

PostPosted: Wed Jun 09, 2010 9:36 pm    Post subject:
Reply with quote

Does ROUNDED not give you what you want?
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: Wed Jun 09, 2010 9:39 pm    Post subject:
Reply with quote

Rounding 66 to 70 is inconsistent with rounding 64 to 64.
Did you mean 64 to 60?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 646
Location: Pennsylvania

PostPosted: Wed Jun 09, 2010 9:51 pm    Post subject:
Reply with quote

If you used 'rounded' then the result is rounded.

You rounded the 10th significant digit into the 9th.

So maybe .093989466 was .0939894664 (notice the 10th digit in Bold) This was rounded down.

It could have been .0939894656 in which case it was rounded up.

Leaving the lengths of the significant digits the same and wanting to change the values is simply not correct.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 09, 2010 9:52 pm    Post subject:
Reply with quote

actually,
would it not be
66 to 7
and
64 to 6
????
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 646
Location: Pennsylvania

PostPosted: Wed Jun 09, 2010 10:02 pm    Post subject:
Reply with quote

It depends, in my example I described 10 digits to 9.

Your example would be for 9 digits to 8.

The OP has to tell us how many digits the end result should be.

My point is that if the end result should be 9 digits, and they used the rounded parameter, then they results are already correct.

I believe that they are try to perform additional rounding in their mind rather than trusting the computer to do its job.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 09, 2010 10:31 pm    Post subject:
Reply with quote

Quote:
I believe that they are try to perform additional rounding in their mind rather than trusting the computer to do its job.


yes dave, I agree,

this is a typical
'i want this'
regardless of how COBOL works.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Jun 10, 2010 4:07 pm    Post subject:
Reply with quote

I'd say even if don't consider how COBOL does it, if one has used 'ROUNDED' then the result is rounded and that's just simple math. Whoever have "invented" "rounded" for COBOL must have used the basic math to write the underline-routine of "ROUNDED" and it won't give what you (vinuk2009) expect.

Probably, You (vinuk2009) just don't want to round off the digits - instead you need something totally different. If so, you should have used some other word to describe what you want in your subject line instead of the word "rounded"; with which we assume that you want what Dave has shown.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Jun 10, 2010 4:11 pm    Post subject:
Reply with quote

Also, please answer what CG has pointed to - answer for that will make your problem better explained.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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