At 10:38 -0400 on 07/23/2007, (IBM Mainframe Discussion List) wrote about Re: EBCDIC to HEX translation in Assembler?:

TABLE    DC    256X'00'
               ORG   TABLE+C'A'
               DC    X'0A0B0C0D0E0F'

ORG TABLE+C'a' or X'81' (just in case you get lower case input)
                DC    X'0A0B0C0D0E0F'

               ORG   TABLE+C'0'
               DC    X'00010203040506070809'
               ORG   ,

You might also want to add code to validate the input string before
translating; i.e., each byte must be between C'A' and C'F' or between C'0' and C'9'.

A TRT of the string using this table will do the job:


TRTTABLE  DC  256X'FF'
          ORG TRTTABLE+C'A'
          DC  6X'00'  A-F
          ORG TRTTABLE+C'a' or X'81' (just in case you get lower case input)
          DC  6X'00'  a-f
          ORG TRTTABLE+C'0'
          DC  10X'00' 0-9
          ORG TRTTABLE+256 (or just ORG)


Any non-HEX character will trigger the early termination of the TRT.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to