Page 1 of 1

Converting Numeric data to Hex

PostPosted: Thu Aug 30, 2012 10:42 am
by Mann_B
Hi All

I have to convert NUmeric data to Hex value.
ex:14974 to '3A7E'
I searched and got t know that if we move 9(5) to 9(04) COMP field we will get o/p as
37
AE

Later then convert those bytes into "displayable" hex.
When I tried like above , I am not getting expected o/p.
I got out put as..
9(5) fld - 14974..When i moved it to 9(4) COMP field..the o/p is 4974.

Can you please let me know how to convert the numeric data to Hex.
Thank you

Re: Converting Numeric data to Hex

PostPosted: Thu Aug 30, 2012 11:39 am
by BillyBoyo
Try a search for BBHEXD.

Re: Converting Numeric data to Hex

PostPosted: Thu Aug 30, 2012 12:03 pm
by Mann_B
I did serach for BHEXD.But I couldnot find related to Numeric to Hex conversion.Please tell me what is BHEXD

Re: Converting Numeric data to Hex

PostPosted: Thu Aug 30, 2012 12:07 pm
by BillyBoyo
BBHEXD is a callable program with which you can display chunks of storage in hex.

Even if you don't want to use the program, the code might give you some ideas. Also if you search for "Bill O'Boyle" and HEX, "Dick Scherrer" and same, "Ronald Burr" and same, you'll find some other methods.

Basically, there's a lot of stuff out there. Google could have got you to something, always with the caveat that a certain amount of the "stuff out there" is rubbish :-)

Re: Converting Numeric data to Hex

PostPosted: Thu Aug 30, 2012 7:29 pm
by dick scherrer
Hello,

I did serach for BHEXD.But I couldnot find

If you searched for BHEXD, that would be a problem . . .

BBHEXD can be found on the internet as well as in our forum.

Re: Converting Numeric data to Hex

PostPosted: Thu Sep 13, 2012 4:36 pm
by Mann_B
HI...

I have defined fld like this.
05 WS-FLD PIC 9(4) BINARY.
05 WS-FLD-X REDEFINES
WS-FLD PIC X(2).

If we move Numeric to WS-FLD then WS-FLD-X will have the Hex value of that numeric field.

Thank you.

Re: Converting Numeric data to Hex

PostPosted: Thu Sep 13, 2012 11:32 pm
by dick scherrer
Hello,

Yes, the "hex value" will be in the x(2) field. Unless we misunderstand what you said you wanted to do, the value will not be "readable" to the eye (i.e. it will not be displayable) . . .