Help using Base SAS procedures

ASCII to EBCDIC problems with $ebcdic. format

Reply
Frequent Contributor
Posts: 124

ASCII to EBCDIC problems with $ebcdic. format

Greetings all.  First let me apologize for starting another thread that is related to one I started two weeks ago or so.  That thread went way off from my original question, so I thought where it ended up warranted it's own thread.  I am having difficulty using the $ebcdic. format.  There are 33 characters that $ebcdic. either returns '00' or it incorrectly translates from ascii.  I should note that when I say 'incorrectly', I mean it is not doing what I need it to do, but I am sure it is doing what it is programmed to do.  To eliminate all possibilities of import errors from our mainframe, I started with decimals 0-255, then used formats to convert them to ascii hex and ebcdic hex.  The attached code file will show what I am needing to do.  Again, I have used an array to translate to suit my needs.  My array will translate based on ebcdic code page 37, and indeed, the 33 suspect translations are as my array translates them using code page 37.  So, I have a couple of questions.

1) How can I determine which translation table $ebcdic is using to translate?  Is it using a translation table?

2) I was able to create a translation table that is stored in sasuser.profile.  Is it possible to tell $ebcdic. to use my translation table, which is the same as ebcdic code page 37.

3) The code page 37 table shown at http://en.wikipedia.org/wiki/EBCDIC_037 shows the unicode equivalents of the ebcdic code points.  I know that for ascii, decimals 0-127 represent the same characters as unicode.  But for 128-255, all bets seem to be off.  Do I need to bring unicode into the equation?

I would so much appreciate any help on this issue.  Since the end of my last thread (thank you so much Tom for your help) I have been working with our mainframe folks and other SAS users here to try to get an answer, as well as read everything I could find about translation tables and formats.  I am again at a point where I am in need of some more leads to follow.  The attached code should be straight forward.

Greg

Attachment
Super User
Posts: 5,092

Re: ASCII to EBCDIC problems with $ebcdic. format

Greg,

Don't know if this will help, but it might be one piece of the puzzle.

Documentation for the BYTE function states that its results will vary on a PC, for 128-255.  It depends on the country of origin for the PC, since different countries use different schemes for 128+. 

Good luck.

Frequent Contributor
Posts: 124

Re: ASCII to EBCDIC problems with $ebcdic. format

Astounding, there might be something to that.  Most of the translations in question are after 128, but there are a few starting with 91.  Also, I checked the ascii hex values SAS is producing using SQL Server, and the results are the same.  But, to your point, that could be because of my machine.  I'm using a HP ProBook 6550b.  Thanks for the tip.

Greg

Ask a Question
Discussion stats
  • 2 replies
  • 393 views
  • 0 likes
  • 2 in conversation