> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[EMAIL PROTECTED] On Behalf Of John Krew
> Sent: Monday, November 21, 2005 1: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

The easiest way, to me, is to transliterate the HLASM program, as
follows:

 WORKING-STORAGE SECTION.
 01 TWO-VARS.
    05 PACKED-VAR PIC S9(3) PACKED-DECIMAL.
    05 CHAR-VAR   REDEFINES PACKED-VAR
                  PIC XX.
 77 OUTPUT-THREE PIC X(3).
 77 OUTPUT-TWO PIC X(2).
 77 I PIC S9(4) BINARY.
*
 LOCAL-STORAGE SECTION.
 LINKAGE SECTION.
 01  MVS-PARM.
     05  MVS-PARM-LENGTH           PIC S999 USAGE BINARY.
     05  MVS-PARM-VALUE            PIC X(120) .
*
 PROCEDURE DIVISION USING MVS-PARM.
 START-UP.
     PERFORM VARYING I FROM 1
                       BY 1
                       UNTIL I > MVS-PARM-LENGTH
         MOVE ZERO TO PACKED-VAR
         MOVE MVS-PARM-VALUE (I:1) TO CHAR-VAR (1:1)
         MOVE PACKED-VAR TO OUTPUT-THREE
         MOVE OUTPUT-THREE (1:2) TO OUTPUT-TWO
         INSPECT OUTPUT-TWO
                 CONVERTING X"F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"
                 TO
                 '0123456789ABCDEF'
         DISPLAY MVS-PARM-VALUE (I:1) ' '
                 OUTPUT-TWO   ' '
                 OUTPUT-THREE
                 UPON SYSOUT
     END-PERFORM

--
John McKown
Senior Systems Programmer
UICI Insurance Center
Information Technology

This message (including any attachments) contains confidential
information intended for a specific individual and purpose, and its'
content is protected by law.  If you are not the intended recipient, you
should delete this message and are hereby notified that any disclosure,
copying, or distribution of this transmission, or taking any action
based on it, is strictly prohibited.
 

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