Just to clarify (and explain different answers already given),

to answer this question we need to know what you mean by "HEX input" and
"DECIMAL output".  If you want to convert binary stored data (often
"displayed" by its hex values) to packed-decimal output, then the approach
listed below is the right way to go.  (I would use COMP-5 instead of COMP to
handle COBOL trunc issues).  If you wanted output to be "display decimal"
just change the output filed from COMP-3 to DISPLAY.

The other answers assumed that your input was in a "character" based field
such as
    "1F2C"  (whatever).

That would require the other approach.

Daniel,
  Let us know WHAT you want to do and we can help more accurately.

"Chase, John" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> > -----Original Message-----
> > From: IBM Mainframe Discussion List On Behalf Of Daniel Cremieux
> > 
> > Dear all
> > 
> > How can we achive this in Cobol ?
> > I don't see any function which can do it
> 
> 77  HEX-FIELD      PIC S9(9) COMP.
> 77  DECIMAL-FIELD  PIC S9(9) COMP-3.
> ..
>     MOVE HEX-FIELD TO DECIMAL-FIELD.
> 
>     -jc-

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