In a message dated 7/23/2007 9:11:16 A.M. Central Daylight Time,  
[EMAIL PROTECTED] writes:
>Wouldn't this just be the PACK command?
 
Not sufficient.
 
>Are you needing it in binary or Packed Decimal?
 
OP wants it translated to "the real hex number."  Without any further  
technical specifications, I would assume, e.g., that EBCDIC "A3" should be  
translated into X'A3'.  In this case two input bytes result in one output  
byte.  
There are other possibilities where the output is not exactly  one-half the 
length 
of the input.  This string is really X'C1F3'.  If  you PACK it you will end 
up with X'013F' which is not the same as X'A3'.   First translate every byte 
into its hex equivalent, then pack with one extra  byte on the right that you 
plan to throw away.
       TR     STRING,TABLE
* STRING now contains X'0A03'.
       PACK   OUTPUT(2),STRING(3)
* OUTPUT now contains X'A3yx', where yx is the inverse of whatever was in  
the first byte of OUTPUT before the PACK executes.  I assumed it contained  
X'xy', so after the PACK the right-most byte has its two nibbles reversed into  
X'yx'.
* You now have the real hex number in the first byte of OUTPUT.
         ... 
STRING   DC    C'A3'
OUTPUT   DS     XL2       
*
TABLE    DC    256X'00'
               ORG   TABLE+C'A'
               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'.  
You can play tricky games to reduce the size of the translate table  
considerably.
 
Bill  Fairchild
Plainfield, IL





************************************** Get a sneak peek of the all-new AOL at 
http://discover.aol.com/memed/aolcom30tour

----------------------------------------------------------------------
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