Actually, probably somewhat superior to what I have described below might be
to define the "translation" array as 256 2-character values: 00, 01, 02,
..., 0A, 0B, 0C, 0D, 0E, 0F, 10, 11 ...

Then you could move the input byte to a redefined comp field and then use it
as a subscript into the array above. Pretty straightforward.

Charles

-----Original Message-----
From: Charles Mills [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 21, 2005 3:41 PM
To: 'IBM Mainframe Discussion List'
Subject: RE: Displaying hexdecimal content of field in Cobol


I'm too lazy to actually write the COBOL, but what you could do is

- Move the data to a field re-defined as a character array
- Define an output area also defined as a character array
- Define yet another character array whose values are C'01234567890abcdef'
- Loop through the first array
- Move each byte to the last character of a comp field initialized to zero
and redefined as characters
- Divide the comp field by 16. Use the quotient to index into the 01234...
array for your first hex output byte. Use the remainder to index for the
second hex byte.
- Repeat for each input byte.

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