View previous topic :: View next topic |
Author |
Message |
vkrishna2001 Beginner
Joined: 07 Aug 2003 Posts: 46 Topics: 18 Location: Danbury
|
Posted: Tue Dec 02, 2003 11:31 am Post subject: Finding value of COMP usage mode item with the hex values |
|
|
Hi,
I am analyzing variable storage dump. I want to find the value of a data item with picture clause S9(13)V9(02) COMP.
If the value of data item is +0000000000617.70 then the hexadecimal value is 000000000000F14A. I can give this hexadecimal value directly to scientific calculator and get decimal value as 61770. But if the value is
-0000000000617.70 then the hexadecimal value is FFFFFFFFFFFF0EB6. From this hexadecimal value how to arrive at -61770? Also how can we decide whether the sign is positive or negative?
Thanks,
Vijayakrishna |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Dec 02, 2003 1:30 pm Post subject: |
|
|
Krishna,
You can use REXX's funtion X2D which will convert the hexadecimal string to a decimal string
Code: |
/* REXX */
MYNUM = X2D('000000000000F14A',8)
SAY MYNUM
MYNUM = X2D('FFFFFFFFFFFF0EB6',8)
SAY MYNUM
|
This will produce the following results.
Check this link which explains in detail the conversion of Hexadecimal to Decimal.
X2D (Hexadecimal to Decimal)
check the following links which can used for other conversions
X2C (Hexadecimal to Character)
X2B (Hexadecimal to Binary)
Hope this helps...
cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
vkrishna2001 Beginner
Joined: 07 Aug 2003 Posts: 46 Topics: 18 Location: Danbury
|
Posted: Wed Dec 03, 2003 11:09 am Post subject: |
|
|
Kolusu,
Thanks a lot for the help.
Vijayakrishna |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Thu Dec 04, 2003 5:57 pm Post subject: |
|
|
Hi Vijay,
Here's another way to convert minus hex values to positive values:
Subtract each hex digit of the minus number from 15 and record the answer. Add 1 to the last digit. It's really a mental arithmetic problem. For example:
FFFFFFFFFFFF0EB6 converts to leading zeros, F149 + 1 = F14A
Code: |
F = 15, sub from 15 = 0 = leading zeros
0 = 0, sub from 15 = F
E = 14, sub from 15 = 1
B = 11, sub from 15 = 4
6 = 6, sub from 15 = 9 + 1 = A
|
Regards, Jack. |
|
Back to top |
|
|
|
|