Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
vinuk2009

New User

Joined: 30 Apr 2009
Posts: 19
Location: chennai

 Posted: Wed Jun 09, 2010 9:29 pm    Post subject: Is it possible to round 9th decimal point in COBOL? 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.

Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

 Posted: Wed Jun 09, 2010 9:36 pm    Post subject: Does ROUNDED not give you what you want?
CICS Guy

Senior Member

Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

 Posted: Wed Jun 09, 2010 9:39 pm    Post subject: Rounding 66 to 70 is inconsistent with rounding 64 to 64. Did you mean 64 to 60?
daveporcelan

Active Member

Joined: 01 Dec 2006
Posts: 683
Location: Pennsylvania

 Posted: Wed Jun 09, 2010 9:51 pm    Post subject: 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.
dbzTHEdinosauer

Global Moderator

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

 Posted: Wed Jun 09, 2010 9:52 pm    Post subject: actually, would it not be 66 to 7 and 64 to 6 ????
daveporcelan

Active Member

Joined: 01 Dec 2006
Posts: 683
Location: Pennsylvania

 Posted: Wed Jun 09, 2010 10:02 pm    Post subject: 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.
dbzTHEdinosauer

Global Moderator

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

Posted: Wed Jun 09, 2010 10:31 pm    Post subject:

 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.
Anuj Dhawan

Senior Member

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

 Posted: Thu Jun 10, 2010 4:07 pm    Post subject: 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.
Anuj Dhawan

Senior Member

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

 Posted: Thu Jun 10, 2010 4:11 pm    Post subject: Also, please answer what CG has pointed to - answer for that will make your problem better explained.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us