Maybe I'm missing something, as this is a bit trickier than the usual shlop, but wouldn't it be more efficient to OI the last byte of &TARGET with x'F0', and skip the MVZ? Using =C'0123...'-C'0' for the TR table of course.
On Mon, Apr 16, 2018 at 11:59 AM, Jonathan Scott < jonathan_sc...@vnet.ibm.com> wrote: > Here's a simplified version of a macro which I've been using to convert > data to printable hex for over 30 years. It uses the extra one-byte > move instead of needing a pad byte, so that the user doesn't need to > know about that, and sets the zones to zero so that it only needs a > 16-byte table, which can default to being a literal. > > MACRO > &LABEL TOHEX &TARGET,&SOURCE > &LABEL UNPK &TARGET.(L'&TARGET-1),&SOURCE > MVC &TARGET+L'&TARGET-1(1),&SOURCE+L'&SOURCE-1 > NI &TARGET,X'0F' > MVZ &TARGET+1(L'&TARGET-1),&TARGET > TR &TARGET,=C'0123456789ABCDEF' > MEND , > > The NI and MVZ can alternatively be done using NC with a literal, and in > the real macro the 16-byte hex table can be provided as a parameter. > > Jonathan Scott > IBM Hursley, UK > -- sas