Date: Thu, 20 Apr 2006 14:26:20 -0700
Reply-To: "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Subject: Re: Convert EBCDIC rep of binary to binary
Content-Type: text/plain; charset="US-ASCII"
To clarify, depending upon what sequence of
events and converting/downloading you have
done already, when I wrote below "convert the
bytes to EBCDIC first", I meant "convert the
bytes to/from EBCDIC first (as applicable)".
Mark
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Terjeson, Mark (IM&R)
Sent: Thursday, April 20, 2006 2:19 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Convert EBCDIC rep of binary to binary
Hi John,
I've only got a couple minutes and your parts
and pieces are a little fuzzy, thus why you
have a good question at this point. But your
subject line leads me one possible direction.
If others have more time to explore just what
your issue is they can post more. But quickly,
if you are needing to take contents that were
EBCDIC and convert to your PIB or other packed
field, you probably just need to convert the
bytes to EBCDIC first and then your packed
formats should work okay, the sample below
takes your initial contents (which I removed
the 'X, so that we can show that the ebcdic
probably needs to come first, since it looks
like packed contents in hex thereafter) and
the contents are converted from EBCDIC first
and then your bytes (as displayed in hex) look
like packed formated hex values. The example
shows converting from ebcdic and then merely
apply the packed informat/format as needed.
data _null_;
str='0B8C7C80660803';
e2a=put(str,$ebcdic14.);
put 'str :' str ;
put 'e2a :' e2a hex14. ;
run;
str :0B8C7C80660803
e2a :F0C2F8C3F7C3F8
NOTE: The data set WORK.TEMP has 1 observations and 2 variables.
NOTE: DATA statement used:
real time 0.00 seconds
cpu time 0.00 seconds
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
John Mattson
Sent: Thursday, April 20, 2006 1:49 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Convert EBCDIC rep of binary to binary
Trying to work with hex on zOS. I have a 14 byte field, which is
the ascii representation of a binary number. 0b8c7c80660803.
----------------------------
ca01EB :0b8c7c80660803
88FFCC44444447F8F8F8FFFFFFFF
3101520000000A02837380660803
But where I need to get to is the actual binary value in a SAS
Numeric value.
------------------------------------------
ca01BI :.......
88FFCC 0878600
310152 bcc0683
I HAVE TRIED...
put(ca01EB,PIB07.); Doesn't work because ca01EB is a char
variable
ERROR 48-59: The format $PIB was not found or could not be loaded.
CA01EBN = INPUT(CA01EB,07.) ; I get
NOTE: Invalid argument to function INPUT at line
And a whole bunch of other things. Can anyone help?
I did find one work "way way way" around...
DATA WORK.TEMP ;
* str='0B8C7C80660803'X;
str='F082F883F783F8F0F6F6F0F8F0F3'x;
put 'str :' str hex28. ;
CALL SYMPUT('x',str);
run;
DATA WORK.TEMP ;
put 'x :' "&x";
y = &x.x;
put 'y :' y hex14. ;
run;