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