One way I know converts one character at a time so would not be good for large numbers of characters, or high frequency. In these cases an assembler routine would be better.
01 FILLER. 02 HEX-SUB PIC S9(4) COMP VALUE ZERO. 02 FILLER REDEFINES HEX-SUB. 03 FILLER PIC X(01). 03 HEX-SUB-BYTE PIC X(01). 02 HEX-IN. 03 HEX-IN-A PIC X(01). 03 HEX-IN-B PIC X(01). 03 HEX-IN-C PIC X(01). 03 HEX-IN-D PIC X(01). 02 CHAR-OUT. 03 CHAR-OUT-A PIC X(02). 03 CHAR-OUT-B PIC X(02). 03 CHAR-OUT-C PIC X(02). 03 CHAR-OUT-D PIC X(02). 02 HEX-DATA. 03 PIC X(32) VALUE '000102030405060708090A0B0C0D0E0F'. 03 PIC X(32) VALUE '101112131415161718191A1B1C1D1E1F'. 03 PIC X(32) VALUE '202122232425262728292A2B2C2D2E2F'. 03 PIC X(32) VALUE '303132333435363738393A3B3C3D3E3F'. 03 PIC X(32) VALUE '404142434445464748494A4B4C4D4E4F'. 03 PIC X(32) VALUE '505152535455565758595A5B5C5D5E5F'. 03 PIC X(32) VALUE '606162636465666768696A6B6C6D6E6F'. 03 PIC X(32) VALUE '707172737475767778797A7B7C7D7E7F'. 03 PIC X(32) VALUE '808182838485868788898A8B8C8D8E8F'. 03 PIC X(32) VALUE '909192939495969798999A9B9C9D9E9F'. 03 PIC X(32) VALUE 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'. 03 PIC X(32) VALUE 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'. 03 PIC X(32) VALUE 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'. 03 PIC X(32) VALUE 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'. 03 PIC X(32) VALUE 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'. 03 PIC X(32) VALUE 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'. 02 FILLER REDEFINES HEX-DATA. 03 HEX-BYTE OCCURS 256 TIMES PIC X(02). MOVE SPACES TO CHAR-OUT. MOVE EIBFN TO HEX-IN. MOVE ZEROES TO HEX-SUB. MOVE HEX-IN-A TO HEX-SUB-BYTE. ADD 1 TO HEX-SUB. MOVE HEX-BYTE (HEX-SUB) TO CHAR-OUT-A. MOVE ZEROES TO HEX-SUB. MOVE HEX-IN-B TO HEX-SUB-BYTE. ADD 1 TO HEX-SUB. MOVE HEX-BYTE (HEX-SUB) TO CHAR-OUT-B. Etc. Craig -----Original Message----- From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf Of John Krew Sent: Monday, November 21, 2005 2:42 PM To: IBM-MAIN@BAMA.UA.EDU Subject: Displaying hexdecimal content of field in Cobol Aside from writing and CALLing a trivial assembler routine, is there any way to display the hexadecimal content of a field in a COBOL program using COBOL syntax? John Krew ---------------------------------------------------------------------- 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