Page 1 of 1

Moving Hex values to Display Format

PostPosted: Fri Dec 19, 2008 9:28 am
by archana_p85
Hi,

I want to move HEX value to display format.
please find below the example of my requirement. Here i want to move(Bolded Field) value 15 to display format and use it for addition.
it tried moving to 9(2),s9(4) comp-3.But value is not moving correctly.
please let me know, what declaration should i Use?

Example:

::MISS/CATHERINE
11DCEE6CCECCDCDC
5149221313859955

Thanks,
Archana

Re: Moving Hex values to Display Format

PostPosted: Fri Dec 19, 2008 9:40 am
by dick scherrer
Hello,

Is there some reason you want to make the intermediate move to "display format"?

Is the value to accumulate fifteen or is it really 21?

Re: Moving Hex values to Display Format

PostPosted: Fri Dec 19, 2008 9:52 am
by archana_p85
Hi Dick,

The value is 15 only. I want to use value 15 as index and want to increment the same.

I tried moving to 9(2) or comp variables,but the value is populating as '0050'


Thanks,
Archana

Re: Moving Hex values to Display Format

PostPosted: Fri Dec 19, 2008 10:07 am
by dick scherrer
Hello,

What should happen when the input value is x'1C'?

Re: Moving Hex values to Display Format

PostPosted: Fri Dec 19, 2008 11:36 am
by archana_p85
sorry for confusing :(

Actual value is 21

Re: Moving Hex values to Display Format

PostPosted: Fri Dec 19, 2008 11:47 am
by dick scherrer
Hello,

If the byte is a true binary value, you can move that one byte to the low-order byte of a 2-byte comp field.
01  comp-num         pic 9(4) comp.
01  comp-num-r redefines the-comp-num.
    05  filler          pic x.
    05  calc-byte       pic x.


in the procedure code,
move zeros to comp-num
move the input byte to calc-byte.

comp-num can now be used to subscript an array (or it can be incremented and then used as the subscript). it is not displayable, but is completely useful for calculating/incrementing.