Thanks Leif and Dennis and others who have replied so far.

I have to say I could not get the code below to do what I wanted (though I
was using ILE RPG and this seem to sometimes want differently sized fields).

What I orignally was trying to ask was exactly what you guys were telling
me to do. That is, once I have the four digit hex code, convert it to a
numeric value.

What I have been unable to see is exactly how to effect the translation of
the binary data returned form the API into a readable decimal value. It
seems somewhere I have just missed some essential code to do the
appropriate moves to accomplish this.

>RPG code  (I-specs not aligned)
>   I         DS
>   I                1   4 HEXCOD
>   I                1   40BINARY
>
>   C                     MOVE CODE      HEXCOD
>   C                     DIV  256       BINARY
>   C                     MVR            DIGIT4  30
>   C                     DIV  256       BINARY
>   C                     MVR            DIGIT3  30
>   C           BINARY    DIV 256        DIGIT1  30
>   C                     MVR            DIGIT2  30
>
>(where CODE is your 4-byte hex code from the API.)

I did toy with the idea of examining each bit of the hex code along the
lines of Leif's suggestion, but thought there must be a smarter way to do
this, however if there isn't I can code that quite happily.

>> 1st hex digit:
>> if hex1 = "1" then digit1 = 1 else
>> if hex1= "2" then digit1 = 2 else
>> if hex1 = "3" then digit1 = 3 else

It's getting those pesky bytes into the right format that is currently
making my hair fall out ! and generate decimal data errors along the way
when I format the receiving field for the move incorrectly.

Thanks again for the assistance so far... surely someone has done this
somewhere else..

Cheers
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].