----- Original Message -----
From: "IBM Mainframe Assembler List" <ASSEMBLER-LIST@LISTSERV.UGA.EDU>
Sent:Mon, 16 Apr 2018 09:06:37 -0400

 On Sat, 14 Apr 2018 17:44:37 +1000, robi...@dodo.com.au wrote:

 >>Since the object is to convert four decimal digits (range 0-9)
 >>to EBCDIC, OC is sufficient.

 > It is? This thread started out about converting System Completion
code to 
 > three characters representing hexadecimal, then diverged into a
more 
 > general discussion of converting binary values into printable hex.
I must
 > have missed the part where it diverged to converting decimal digits
to 
 > printable characters. For that, there is no need to OR anything but
the 
 > last byte of the UNPKed data.

That's what I just said.

However, if the aim is to convert a 12-bit binary integer value to
display form, treating each four bits as a hex digit in the range
0-9,A-F,
you cannot use UNPK.
The reason relates to the last two nibbles.  UNPK swaps these two
nibbles during the conversion.
Thus, using OI to put in a zone of F destroys the final digit.

To use UNPK, then you need to UNPK one extra trailing byte.
The nibbles of the extra byte will be swapped (as expected)
but they can be ignored.  The four nibbles obtained from the
12-bit binary integer will be in four separate bytes, with a zone of
F.
(the leading zoned digit will, of course, be zero, and can be ignored
too.)


Reply via email to