How to calculate size of a COMP-3 and COMP variables



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: How to calculate size of a COMP-3 and COMP variables

Postby Robert Sample » Tue Oct 04, 2016 2:55 am

jygboy, you are responding to a topic that originated 8 and 1/2 years ago, even though it was updated more than 4 years ago -- by someone similarly answering a years-old question. Furthermore, you overly complicate the calculation -- (number of digits + 1) / 2 gives a value that either ends with .0 or .5. If .5, round up to next integer, otherwise just use the integer part of the result.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post