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

Author Message
dilip_bangalore

New User

Joined: 29 Sep 2011
Posts: 27
Location: India

 Posted: Thu Apr 12, 2012 10:56 am    Post subject: Rounded option in cobol Hi, Does rounded option in cobol for 12.95, gives next number 13 ? Regards, Dilip

Peter cobolskolan

Active User

Joined: 06 Feb 2012
Posts: 104
Location: Sweden

Posted: Thu Apr 12, 2012 11:26 am    Post subject: Reply to: Rounded option in cobol

 Code: If this is one of those "Interview questions"     The answere is: Yes, and read the manual Else     The answere is: Test it, and read the manual End If

This assumes the result variable is declared without decimals.
chandu ravichandra

New User

Joined: 10 Apr 2012
Posts: 6
Location: INDIA

 Posted: Thu Apr 12, 2012 2:38 pm    Post subject: Reply to: Rounded option in cobol Hi, It will round it to 13.. The result variable will have 13.....
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7315

Posted: Thu Apr 12, 2012 2:58 pm    Post subject: Reply to: Rounded option in cobol

 Language Reference (emphasis added) wrote: ROUNDED phrase After decimal point alignment, the number of places in the fraction of the result of an arithmetic operation is compared with the number of places provided for the fraction of the resultant identifier. When the size of the fractional result exceeds the number of places provided for its storage, truncation occurs unless ROUNDED is specified. When ROUNDED is specified, the least significant digit of the resultant identifier is increased by 1 whenever the most significant digit of the excess is greater than or equal to 5.

I think this is a little unclear. The paragraph would be better split into two. Maybe like this would be clearer:

 Quote: When ROUNDED is specified, the least significant digit of the resultant identifier is increased by 1 whenever the most significant digit of the excess is greater than or equal to 5. When the size of the fractional result exceeds the number of places provided for its storage, truncation occurs unless ROUNDED is specified.
PeterHolland

Global Moderator

Joined: 27 Oct 2009
Posts: 2442
Location: Netherlands, Amstelveen

 Posted: Fri Apr 13, 2012 1:28 pm    Post subject: And because of that the language Reference cant be used any more?
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7315

 Posted: Fri Apr 13, 2012 1:50 pm    Post subject: Reply to: Rounded option in cobol :-) How would you come to that conclusion, Peter? Second Peter, that is. In this thread, anyway. First Peter in our Hearts.
 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 Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm MQ command in option 6 of ISPF! Vignesh Sid All Other Mainframe Topics 3 Tue Sep 26, 2017 6:01 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

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