View previous topic :: View next topic
|
Author |
Message |
suresh.gb
New User
Joined: 06 Dec 2006 Posts: 1 Location: Bangalore
|
|
|
|
05 A Pic S9(4) comp
05 B Pic X(4)
Move " 3000" to B.
Move B To A.
What is the value of A of executing the above statement. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
If the move worked (a redefine would be easier in this case) a would equal 4092653808 which is the decimal value of 11110011111100001111000011110000 which is the binary value of F3F0F0F0 which is the hec value of 3000 which is the character value of 4092653808. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Hello suresh.gb,
Quote: |
05 A Pic S9(4) comp
05 B Pic X(4)
Move " 3000" to B.
Move B To A.
What is the value of A of executing the above statement.
|
The compiler is probably to smart for its own good. It will make the assumption that you are moving numeric data and convert the char string ?3000? to binary on the move.
The Field ?A? will have a value of 3000, hex value x?0BB8?. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
This code
Code: |
01 SOMESTUFF.
05 A PIC S9(4) COMP.
05 B PIC X(4).
MOVE "3000" TO B.
MOVE B TO A.
DISPLAY 'A=' A.
DISPLAY 'B=' B.
DISPLAY ' '.
|
returns
Interestingly, this code
Code: |
MOVE "00AB" TO B.
MOVE B TO A.
DISPLAY 'A=' A.
DISPLAY 'B=' B.
DISPLAY ' '.
|
returns
while this code
Code: |
MOVE "00@\" TO B.
MOVE B TO A.
DISPLAY 'A=' A.
DISPLAY 'B=' B.
DISPLAY ' '.
|
returns an 0C7. |
|
Back to top |
|
|
|