In article <CAPtSOKzBLsKuU0=dJLCJ_M8qhBMB0mU_ueirHUM1OBD=f6g...@mail.gmail.com>,
Billy Ashton wrote:

> How do I take a 1-byte character field containing a Hex value like x'C4'
> and turn it into a 2-byte character field containing C4 (x'C3F4')? I know
> how to turn it into a decimal value and Edit and all that, but I am
> blanking on this simple conversion.

One way is with three TR instructions, and some MVC instructions.  One TR
instruction translates each character into the EBCDIC representation of the
first half, one TR instruction converts each to the EBCDIC representation of
the second half, and one interleaves them.  Up to 128 bytes of input can be
handled per pass through this sequence.

Another way uses the UNPK command (from a source which includes a dummy byte
in the next byte of storage) followed by a single TR instruction.  That uses
less storage but is limited to 7 bytes of input per pass.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to