Page 1 of 1

Maximum Value

PostPosted: Tue Sep 08, 2009 4:39 pm
by srn123
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,

Re: Maximum Value

PostPosted: Wed Sep 09, 2009 3:02 am
by dick scherrer
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.

Re: Maximum Value

PostPosted: Wed Sep 09, 2009 9:53 am
by srn123
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!

Re: Maximum Value

PostPosted: Thu Sep 10, 2009 12:27 am
by dick scherrer
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).