Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need assistance with converting Assembler code to Rexx

49 views
Skip to first unread message

Trimble, John

unread,
May 9, 2013, 1:02:49 PM5/9/13
to
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?




John Trimble, CISSP
Information Security Technical Architect
Corporate Security
Fishers, IN
317-806-0269
john.t...@salliemae.com

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Paul Gilmartin

unread,
May 9, 2013, 1:17:25 PM5/9/13
to
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

Bill Ashton

unread,
May 9, 2013, 1:30:57 PM5/9/13
to
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
--
Thank you and best regards,
*Billy Ashton*

Lizette Koehler

unread,
May 9, 2013, 1:43:29 PM5/9/13
to
John,

Is the LASTEXDT being packed earlier in the assembler routine? If so, then why pack and unpack. You could handle a source date in rexx with little issue.

What is being done to the field that feeds LASTEXDT? If it is already packed in the data you are sifting, then no issue, if it is source, then I would not pack it and unpack it.



Lizette


-----Original Message-----
>From: "Trimble, John" <john.t...@SALLIEMAE.COM>
>Sent: May 9, 2013 10:02 AM
>To: TSO-...@VM.MARIST.EDU
>Subject: [TSO-REXX] Need assistance with converting Assembler code to Rexx
>
>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?
>
>
>
>
>John Trimble, CISSP
>Information Security Technical Architect
>Corporate Security
>Fishers, IN
>317-806-0269
>john.t...@salliemae.com

Trimble, John

unread,
May 9, 2013, 1:53:35 PM5/9/13
to
The Packed data is in a file used by other programs, so I need to leave it in Packed when I am done.




John Trimble, CISSP
Information Security Technical Architect
Corporate Security
Fishers, IN
317-806-0269
john.t...@salliemae.com


This E-Mail has been scanned for viruses.

Trimble, John

unread,
May 9, 2013, 1:54:20 PM5/9/13
to
Thanks, just what I needed.




John Trimble, CISSP
Information Security Technical Architect
Corporate Security
Fishers, IN
317-806-0269
john.t...@salliemae.com


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On Behalf Of Bill Ashton
Sent: Thursday, May 09, 2013 1:31 PM
To: TSO-...@vm.marist.edu
Subject: Re: [TSO-REXX] Need assistance with converting Assembler code to Rexx

This E-Mail has been scanned for viruses.

Itschak Mugzach

unread,
May 9, 2013, 1:59:27 PM5/9/13
to
Bill showed you the way to do PD to ZONE conversion. You can go back from
ZONE to PD after the math. invovled.

ITschak
0 new messages