Okay, I was getting some wires crossed over this in that I 
conflated the special case of converting binary data to a hexadecimal character 
string and the general case where binary data in (putatively) packed decima 
format is converted to a decimal character string.I’ve written code to perform  
both tasks many times and am actually a pretty competent (accomplished, even) 
Mainframe assembler programmer but I’m also at the end of a long sabbatical 
leave and some rust build-up is inevitable I guess.I’m excited to put my 
talents back into income-generating use once more.
Sorry for any confusion y’all Keven

On Fri, Apr 13, 2018 at 9:17 AM -0500, "Seymour J Metz" <sme...@gmu.edu> wrote:

Of course; the standard way to convert binary to hex is the UNPK/TR with a one 
byte pad.

Shmuel (Seymour J.) Metz

From: IBM Mainframe Assembler List  on behalf of Martin Ward 
Sent: Friday, April 13, 2018 10:13 AM
To: ASSEMBLER-LIST@listserv.uga.edu
Subject: Re: SDWA - SDWACMPC conversion

On 13/04/18 15:02, Seymour J Metz wrote:
> Unpacking x'0123' gives you x'F0F132'; the OI then gives you
> x'F0F1F2'; what you want is x'F0F1F2F3'. Or with an UNNPK length of 4
> you get x'F0F0F1F2'; still not what you want.

Suppose the byte after the X'0123' is X'xy' (where x and y are
any hex digits).

Unpacking X'0123xy' (with a source length of 3 and a destination
length of 5) gives you X'F0F1F2F3yx' which, when you drop
the last byte, gives you what you want.

This assumes that there is an addressable byte immediately after X'0123'
For a general solution, copy the source field to a sufficiently
large work area before unpacking.


Dr Martin Ward | Email: mar...@gkc.org.uk | 
G.K.Chesterton site: 
 | Erdos number: 4

Reply via email to