On 3/20/2013 3:03 AM, Donald Likens wrote:
Has anyone come up with a better way to convert a 64 bit binary number to 
decimal then the way I did it?

Here is what I did:

         LG    R1,WKCELLD
         CVDG  R1,LONG
        * UNPK  0(11,R7),LONG(6)   FIRST 6 BYTES ARE ALWAYS ZERO
         UNPK  0(11,R7),LONG+5(6)
         UNPK  10(11,R7),LONG+10(6)
         OI    20(R7),X'F0'


To be precise, you are converting 64bit binary to zoned decimal unedited.
How about:

        LG    R1,WKCELLD
        CVDG  R1,LONG
        mvc   0(17,R7),edpat
        ed    0(17,R7),long

edpat   dc    x'4020202020202020202020202020202020'


You haven't told us how long the target field pointed
at by R7 is, but it's at least 21 bytes judging by
your OI instruction. So I've just used the first 17
bytes. The field LONG must, of course, be 16 bytes
on a quadword boundary.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
    for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to