View previous topic :: View next topic
|
Author |
Message |
Ranjith741
New User
Joined: 04 Jun 2013 Posts: 9 Location: India
|
|
|
|
Hi,
I want to declare a Working Storage variable in the program
10 XYZ-AMT PIC S9(18)V9(18).
I have tried the compiler option CBL ARITH(EXTEND) but it is allowing a maximum of 31 digits.
Can anyone suggest any ideas to handle 36 digits numeric variable.
Thanks in advance. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Why is there a need to have more than 31? what is the source for your program? |
|
Back to top |
|
|
Ranjith741
New User
Joined: 04 Jun 2013 Posts: 9 Location: India
|
|
|
|
Actually this program is designed to be used as a currency coverter alongwith some business logic. Hence each digit after decimal point matters |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Go see the person who specified the program logic. ask them how many decimals should be used. Generally no more than 5 or 6 should be required. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Quote: |
Hence each digit after decimal point matters |
How does 0.000000000000000001 value impacts or improves your currency converter?? Please show us any sample calculations. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
Generally no more than 5 or 6 should be required. |
the majority of the requirements is satisfied by using 2 decimal digits more than the decimal digits displayed
E.G.: 4 decimals displayed 6 decimals used for computations |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you really feel that you need 36 digits it is simple.
You define one field of 18 for the integer part, and an second field of 18 for the decimal part.
Then you process them separately.
Would this be necessary for a currency-conversion? Not in the least, it would be absurd, but if it's The Requirement... |
|
Back to top |
|
|
Ranjith741
New User
Joined: 04 Jun 2013 Posts: 9 Location: India
|
|
|
|
Quote: |
How does 0.000000000000000001 value impacts or improves your currency converter?? Please show us any sample calculations. |
Thanks for your inputs Rohit. This is purely a Business requirement. As developers, do not have much say over the Business significance of these values.
Quote: |
You define one field of 18 for the integer part, and an second field of 18 for the decimal part. |
Thanks Bill. I was keeping this as a last option and looking for any way around.
Thanks you guys for providing your inputs.
Regards,
Ranjith Kumar |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I think you should take at least one shot at talking to them about this. What do they need 18 integer digits for? 123,456,789,123,456,789. In any existing traded currency, that is far bigger than could be needed excluding massive hyper-inflation.
Unless reporting to an absurd and useless number of decimals, you will never need anywhere near 18 digits.
Even using extended-double-precision (or whatever it is called) floating point values, I don't think you can can 36 significant digits. In fact I'm certain you can't.
So what is the point of the whole thing?
If it makes no sense, you don't just do it without a struggle with them first, because it may mean that you have missed something (or they have). |
|
Back to top |
|
|
Ranjith741
New User
Joined: 04 Jun 2013 Posts: 9 Location: India
|
|
|
|
Sure Bill. I will definitely raise this as a serious concern to right folks.
Just wanted to check all the available options before highlighting this as a genuine show stopper. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
There is no way in COBOL to handle more than 31 digits as a single variable. If you cannot get the requirement changed to something more reasonable, you will have to use two variables for the data as suggested. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
I didn't think Turkish Lira was being used anymore? |
|
Back to top |
|
|
seagull
New User
Joined: 28 May 2007 Posts: 24 Location: Dublin
|
|
|
|
The only reason I can see for that number of decimals is someone wanting to know how many Zimbabwean dollars you get for £0.000000000000000001
Except that the Zimbabwean dollar is no longer in use. |
|
Back to top |
|
|
|