|
|
| Author |
Message |
Tom Goodhart
New User
Joined: 16 Jul 2008 Posts: 2 Location: Tennessee
|
|
|
|
Not coding the S for sign in the picture will cause values to be stored with "F" as the sign. An positive integer value which mathematically equal to +1.
If you code an even number of digits, the compiler will always make it 1 byte larger internally.
Thus,
S9(6) COMP-3 will take 4 bytes of storage
S9(7) COMP-3 will take 4 bytes of storage This is the preferred way as it is clear to anyone what was intended. |
|
| Back to top |
|
 |
References
|
Posted: Fri Jul 18, 2008 1:18 am Post subject: Re: |
 |
|
|
 |
Gousiya Mulla
New User
Joined: 02 Jun 2008 Posts: 22 Location: bangalore
|
|
|
|
| Quote: |
If the number is +1234.It is stored as,
(In Hex) 01 23 4C
|
Is this
(In Hex) 4D2 ? . Please clear me . |
|
| Back to top |
|
 |
Robert Sample
Senior Member
Joined: 06 Jun 2008 Posts: 534 Location: Atlanta, GA
|
|
|
|
No:
Hex 0004D2 is the BINARY (or COBOL COMP) value of +1234.
Hex 01234C is the PACKED-DECIMAL (or COBOL COMP-3) value of +1234.
Hex F1F2F3F4 is the unsigned COBOL DISPLAY value of 1234.
Hex F1F2F3C4 is the signed COBOL DISPLAY value of +1234. |
|
| Back to top |
|
 |
Gousiya Mulla
New User
Joined: 02 Jun 2008 Posts: 22 Location: bangalore
|
|
|
|
Robert ,
Understood .. Thax |
|
| Back to top |
|
 |
|
|