Date: Thu, 18 Jun 1998 18:05:05 -0400
Reply-To: "Dorfman, Paul" <pdorfma@UCS.ATT.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Dorfman, Paul" <pdorfma@UCS.ATT.COM>
Subject: Re: MVS/EBCDIC SAS question, unsigned packed format?
Thomas Hanan <thomas.hanan@PRUDENTIAL.COM>, in part, wrote:
>This question falls under the category "there's gotta be a format for
>this". I've scanned my battered language manual and tech report P-222,
>unless I've just missed it somewhere, I can't find a format that does
>I want. What I'm looking for is a format that will create an unsigned
>numeric value. For example, I want the numeric value 123456789 to show
>as (in hex):
>The PDw. format sticks a sign on the last half-byte (or nibble, as the
>manual humorously refers to it) so the if I output this number as PD5.,
>shows up as:
>Not a big deal to me, but then again, I'm a SAS programmer, I can read
>anything. The problem is, I'm creating this file for a COBOL
>and she doesn't want the sign on there... So, what to do? I've come
>with the following (very ugly) code, which works, but I don't like it.
>Please tell me that I just haven't read my documentation thoroughly and
>that there's a handy-dandy format to produce the desired output.
Your code is not ugly, and yes, you can read anything, even this really
ugly packed hexadecimal where low nibble has no meaning, with $PHEX5w..
But write it with a format can you not, to the best of my awareness.
Maybe SI has decided that writing data this way doesn't make sense; I
tend to agree with that. If I have an always positive numeric with even
number of digits and want to save a byte, then PKw. will do it just
fine. If the sign is significant, then PDw. will do the job. But why
lose a byte and have nothing in return?
All that having been said, I'd still like to have something like PHEXw.
just in case like yours, so that it would be easier to satisfy the needs
of some Cobol folks insisting that the insane data representation be
used merely because of being too lazy to change a copybook. And, of
course, I'd be happy to find out that I'm wrong, that packed hexadecimal
with trailing x'f' is quite important and necessary, and that a format
to write it already exists.
Sorry it wasn't too much of a consolation...
Paul M. Dorfman
Citibank UCS Decision Support Systems