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
 

 

Declaring numeric variable to handle more than 31 digits

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

New User


Joined: 04 Jun 2013
Posts: 9
Location: India

PostPosted: Wed Apr 30, 2014 12:02 pm    Post subject: Declaring numeric variable to handle more than 31 digits
Reply with quote

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
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Apr 30, 2014 12:41 pm    Post subject:
Reply with quote

Why is there a need to have more than 31? what is the source for your program?
Back to top
View user's profile Send private message
Ranjith741

New User


Joined: 04 Jun 2013
Posts: 9
Location: India

PostPosted: Wed Apr 30, 2014 12:50 pm    Post subject:
Reply with quote

Actually this program is designed to be used as a currency coverter alongwith some business logic. Hence each digit after decimal point matters icon_confused.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Wed Apr 30, 2014 1:08 pm    Post subject: Reply to: Declaring numeric variable to handle more than 31
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Apr 30, 2014 1:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Apr 30, 2014 1:49 pm    Post subject: Reply to: Declaring numeric variable to handle more than 31
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7230

PostPosted: Wed Apr 30, 2014 2:06 pm    Post subject: Reply to: Declaring numeric variable to handle more than 31
Reply with quote

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
View user's profile Send private message
Ranjith741

New User


Joined: 04 Jun 2013
Posts: 9
Location: India

PostPosted: Wed Apr 30, 2014 2:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7230

PostPosted: Wed Apr 30, 2014 3:15 pm    Post subject: Reply to: Declaring numeric variable to handle more than 31
Reply with quote

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
View user's profile Send private message
Ranjith741

New User


Joined: 04 Jun 2013
Posts: 9
Location: India

PostPosted: Wed Apr 30, 2014 3:31 pm    Post subject:
Reply with quote

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. icon_exclaim.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Apr 30, 2014 4:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 30, 2014 4:21 pm    Post subject: Reply to: Declaring numeric variable to handle more than 31
Reply with quote

I didn't think Turkish Lira was being used anymore? icon_lol.gif
Back to top
View user's profile Send private message
seagull

New User


Joined: 28 May 2007
Posts: 24
Location: Dublin

PostPosted: Wed May 28, 2014 4:04 pm    Post subject:
Reply with quote

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
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
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


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