🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.tsorexx
Article #83

Re: Need assistance with converting Assembler code to Rexx

#83
From: Bill Ashton
Date: Thu, 09 May 2013 17:30
62 lines
3147 bytes
Here is a simple Packed to Decimal routine I have called (I call it P2D)
that will work with standard definitions:
/* REXX */
hex = C2X(Arg(1));
result = Left(hex,Length(hex)-1);
If Right(hex,1) = 'D' Then Return '-'result; Else Return result;

and then to go back from decimal to packed (yep, called D2P), using only C
and D nibbles:
/* Rexx decimal to packed */
arg dec
If dec < 0 then s = 'D'; else s = 'C'
n = space(translate(dec,,'+-.')s,0)
Return X2C(right(n,length(n)+length(n)//2,'0'))

Billy



On Thu, May 9, 2013 at 1:16 PM, Paul Gilmartin <PaulGBoulder@aim.com> wrote:

> On 2013-05-09, at 11:02, Trimble, John wrote:
>
> > I have an assembler program I am converting to Rexx that issues the
> following:
> >
> >         SP    LASTEXDT,=P'1'           SUBTRACT 1 DAY
> >
> > Against a field defined like this:
> >
> > LASTEXDT DS    PL8
> >
> > This is packed Decimal data.
> >
> > How would I go about doing the same thing in Rexx?
> >
> Rexx's only numeric data type is decimal display.  You
> can use the c2x() builtin to convert packed decimal
> to decimal display.  Sort of.  You need some special
> tweaking to handle the last nybble which represents
> the sign.  It's almost but not quite entirely unlike
> UNPK.
>
> If you need to, reverse the process using x2c(),
> after fixing the sign.
>
> -- gil
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to LISTSERV@VM.MARIST.EDU with the message: INFO TSO-REXX
>



--
Thank you and best regards,
*Billy Ashton*

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LISTSERV@VM.MARIST.EDU with the message: INFO TSO-REXX
Technical Details
Message-ID: <CAPtSOKzh9Nd=Tu+Yz9xdX6Huixkbz2uNazVKNcV=8r3rpn2KEA@mail.gmail.com>
Path: arc1-ca.pugleaf.net!bp1ni1933pbd.1!nntp.google.com!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!newsgate.newsguy.com!newsp.newsguy.com!mdrn
References: <2B84FC12F4FD9B4AB07CB1F618BB45F6026387@pwnifiex020.us.ad.usa-ed.net> <685473E0-B4A9-4515-BBB8-1C188D3CCD93@aim.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11415f,9728ee7782158977
X-Google-NewGroupId: yes
X-Google-Attributes: gid357a14e69d,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
X-Received: by 10.66.216.166 with SMTP id or6mr3274040pac.26.1368120658107;
        Thu, 09 May 2013 10:30:58 -0700 (PDT)
Path: arc1-ca.pugleaf.net!bp1ni1933pbd.1!nntp.google.com!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!newsgate.newsguy.com!newsp.newsguy.com!mdrn
From: bill00ashton@GMAIL.COM (Bill Ashton)
Newsgroups: bit.listserv.tsorexx
Subject: Re: Need assistance with converting Assembler code to Rexx
Date: 9 May 2013 10:30:57 -0700
Organization: None
Lines: 62
Message-ID: <CAPtSOKzh9Nd=Tu+Yz9xdX6Huixkbz2uNazVKNcV=8r3rpn2KEA@mail.gmail.com>
References: <2B84FC12F4FD9B4AB07CB1F618BB45F6026387@pwnifiex020.us.ad.usa-ed.net>
            <685473E0-B4A9-4515-BBB8-1C188D3CCD93@aim.com>
Reply-To: TSO REXX Discussion List <TSO-REXX@vm.marist.edu>
NNTP-Posting-Host: localhost.newsguy.com
Mime-Version: 1.0
NNTP-Posting-Date: 9 May 2013 17:30:57 GMT
X-Received-Bytes: 2611
Content-Type: text/plain; charset=ISO-8859-1