View previous topic :: View next topic
|
Author |
Message |
seman18
New User
Joined: 08 Feb 2009 Posts: 67 Location: hz
|
|
|
|
I tried to store binary number into char, it shows 63 in hex
Code: |
DCL BIN_E FIXED BIN(7) INIT(99);
DCL P5_E CHAR(1) BASED(ADDR(BIN_E)); |
however, when I change the below, it shows 00 in hex, why it failed? I am confused.
Code: |
DCL BIN_E FIXED BIN(8) INIT(99);
DCL P5_E CHAR(1) BASED(ADDR(BIN_E)); |
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
A FIXED BIN (7) can occupy one byte; a FIXED BIN (8) must occupy two (SIGNED is implied). P5_E is defined on the first byte of BIN_E. In your first example, the internal representation of 99 is 63; in the second, it's 0063...and P5_E is defined on the 00, which you are seeing. |
|
Back to top |
|
|
|