Maximum Value



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

Maximum Value

Postby srn123 » Tue Sep 08, 2009 4:39 pm

Hi,

Could anyone tell me what is the maximum value that can be stored in s9(04) comp and s9(09) comp and also the method to it find out?

Thanks,
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Maximum Value

 

Re: Maximum Value

Postby dick scherrer » Wed Sep 09, 2009 3:02 am

Hello,

s9(04) comp = 9999
s9(09) comp = 999999999
There really is no method - it is just the field definition. Pic s9(3) has a max of 999, etc. . .

I suspect this may not be what you are looking for. . .

This link shows more about numeric data:
http://publibz.boulder.ibm.com/cgi-bin/ ... 0/5.3.17.1

If this is not what you are looking for, please clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Maximum Value

Postby srn123 » Wed Sep 09, 2009 9:53 am

Just a thought. When I went through the below link, it says a 2 bytes binary half word can accept range of values from
-32768 to +32768. S9(04) COMP being 2 bytes,shouldn't it to take only the same range of values and not 9999?
Similarly for S9(09) COMP, being 4 bytes take the range -2,147,483,648 through +2,147,483,647?

Actually this was what my question was..in the previous post regarding the maximum value. Please correct me if I am wrong.

Thanks!
srn123
 
Posts: 13
Joined: Wed Aug 26, 2009 6:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Maximum Value

Postby dick scherrer » Thu Sep 10, 2009 12:27 am

Hello,

As you have seen, there is a difference between the max value in a 2-byte field and a pic 9(4) comp field. This is not a problem, just something to be aware of.

it says a 2 bytes binary half word can accept range of values from -32768 to +32768.
Not quie true/complete. A 2-byte binary value might contain from zero to 65535 also (if it is unsigned).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post