<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: $ebcdic missing 8 bytes with locale off in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190136#M35875</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The mapping from EBCDIC -&amp;gt; ASCII and back again is not well defined.&amp;nbsp; Most mappings I have seen are not reversible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example how do we map the EBCDIC code 15 (which is intended as NL or NEW LINE) to ASCII?&amp;nbsp; There is not a direct equivalent.&amp;nbsp; Perhaps we should map it to the code for LF.&amp;nbsp; That makes good sense on a Unix system that uses LF as the end of line character in text files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are you actually trying to achieve?&amp;nbsp; Perhaps you would get better results using TRANSLATE function instead of the $EBCDIC format?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Apr 2014 22:11:09 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2014-04-22T22:11:09Z</dc:date>
    <item>
      <title>$ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190131#M35870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings all.&amp;nbsp; The short of it is that even with the 'locale' option commented out in my config file, the $ebcdic format still fails to translate 8 characters correctly according to IBM-037 code page.&amp;nbsp; This is a great improvement over the 33 missing translations when local is set to en_us, but I still would like to get them all working.&amp;nbsp; I'm using 9.3 on Windows 7 32 bit.&amp;nbsp; I've tried using trantab to edit both the ansiebcd and ebcdic tables, and saved them to my sashelp.host library, but they don't appear to have anything to do with the $ebcdic format.&amp;nbsp; Based on what I found when googling, it seems the $ebcdic format uses translation tables loaded (and uneditable?) at start up.&amp;nbsp; I'm just wondering if there is a way to fix this issue.&amp;nbsp; My work around is to load up an array with the round-trip values of extended ascii to ebcdic(037) and back, then use that array to compare byte by byte.&amp;nbsp; It works, but seems a bit of overkill.&amp;nbsp; I'm using odbc to pull data from DB2, one field of which is binary data that contains fields of text and also packed decimal.&amp;nbsp; I need to convert the binary to hex, then parse out the packed decimal.&amp;nbsp; I know I could just use the DB2 HEX() function to convert before I import, but that would spoil the fun.&amp;nbsp; Anyhow, the attached program should basically show the problem.&amp;nbsp; If you run it, the result will be a table of the 8 error bytes I need to fix.&amp;nbsp; Any help would be much appreciated.&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Edit* - I found this, &lt;A href="http://support.sas.com/kb/14/742.html" title="http://support.sas.com/kb/14/742.html"&gt;14742 - Generated translation tables for $EBCDICw. and $ASCIIw. informatscontain invalid values&lt;/A&gt;, which seems to speak to the issue of locale, but also seems to imply the missing values are attributable to '00'x being in many of the cells.&amp;nbsp; However, the 8 I'm missing must be values other than '00'x that are just wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Added link - Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 17:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190131#M35870</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-22T17:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190132#M35871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please explain your issue more in detail.&lt;/P&gt;&lt;P&gt;There are chars in Ebcdic that cannot be converted to Ascii. Tey are mostly faked ( not sign, cent sign) the special control chars (eof,lf,cr) also having issues.&lt;/P&gt;&lt;P&gt;You could use utf-8 as used at Windows/office Html, but the mainframe is not supporting that.&amp;nbsp; That issue-s are part of NLS, see:&lt;A href="http://support.sas.com/documentation/cdl/en/nlsref/67110/HTML/default/viewer.htm#n1h5t4ef03g16kn1ks6knjnnvrjl.htm" title="http://support.sas.com/documentation/cdl/en/nlsref/67110/HTML/default/viewer.htm#n1h5t4ef03g16kn1ks6knjnnvrjl.htm"&gt;SAS(R) 9.4 National Language Support (NLS): Reference Guide, Second Edition&lt;/A&gt; as both sides codepages are important. By the way the latin1 charset of Windows (java) is not the same as that of Unix based ones.&lt;/P&gt;&lt;P&gt;You could get traumatized.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 17:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190132#M35871</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-04-22T17:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190133#M35872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jaap, this is about as simple as I can get it...&lt;/P&gt;&lt;P&gt;data _null_ ; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ascii_hex = put(byte(10),$hex2.) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ebcdic_hex = put(put(byte(10),$ebcdic.),$hex2.) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'ascii_hex for decimal value 10 = ' ascii_hex ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'ebcdic_hex using $ebcdic. = ' ebcdic_hex ', but it should be 25' ;&lt;/P&gt;&lt;P&gt;run ; quit ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 8 codepoints not properly translating when using the $ebcdic format with locale= turned off.&amp;nbsp; This is just a visual of decimal value 10 (ascii code point '0A').&amp;nbsp; It should map to ebcdic codepoint '25', but the $ebcdic format maps it to '15'.&amp;nbsp; The other decimal values not properly translating, as per IBM_037 are 91, 93, 94, 133, 168, 172, and 221)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifically, does anyone know of a way to change the mapping of the 8 decimal values listed above when using the $ebcdic format? I've checked my array workaround on millions of observations, and the translations I took from the 'Code page translation' section at the bottom of &lt;A href="http://en.wikipedia.org/wiki/EBCDIC_037" title="http://en.wikipedia.org/wiki/EBCDIC_037"&gt;EBCDIC 037 - Wikipedia, the free encyclopedia&lt;/A&gt; are accurate for my data 100% of the time.&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 18:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190133#M35872</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-22T18:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190134#M35873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like an issue to bring up with Tech Support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 19:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190134#M35873</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-22T19:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190135#M35874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greg, your refered to a note 14742 that advices to remove the locale setting .... that is another issue.&lt;/P&gt;&lt;P&gt;I give you the link to&amp;nbsp;&amp;nbsp; MAPEBCDIC2ASCII=TRANTAB &lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;catalog-entry &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; (System Option) as it the one defining your own trantab. The associated note there:&lt;/P&gt;&lt;P class="xis-cautionLeadin"&gt;&lt;EM&gt;Do not change a translation table unless you are familiar with its purpose.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P class="xis-paraSimple"&gt;&lt;EM&gt;&lt;A id="n0v6rxvx0jxoaln1ea45m5idb9o0"&gt;&lt;/A&gt;Translation tables are used internally by SAS to implement NLS. If you are unfamiliar with translati&lt;/EM&gt;on &lt;EM&gt;tables, do not change the specifications without proper technical advice. &lt;/EM&gt;&lt;/P&gt;&lt;P class="xis-paraSimple"&gt;For your fun I18N &lt;A href="http://support.sas.com/resources/papers/proceedings13/025-2013.pdf" title="http://support.sas.com/resources/papers/proceedings13/025-2013.pdf"&gt;http://support.sas.com/resources/papers/proceedings13/025-2013.pdf&lt;/A&gt;&lt;/P&gt;&lt;P class="xis-paraSimple"&gt;The systemprogrammer(s) on the mainframe is most likely to have set codepage 034 not 037 (z/OS and DB/2) . The same would be valid for your pc. US more likely 437, Europe as 850.&lt;/P&gt;&lt;P class="xis-paraSimple"&gt;&lt;/P&gt;&lt;P class="xis-paraSimple"&gt;Using your ODBC-connection I only can see as something connecting to DB/2 it is not a filetransfer. Did you something special to have that in an binary connection? Normally that connection is included with that translation. This will spoil all your attempt on converting binary data to something usefull as you need to revert that ODBC translation (hidden in the driver).&amp;nbsp; &lt;/P&gt;&lt;P class="xis-paraSimple"&gt;&lt;/P&gt;&lt;P class="xis-paraSimple"&gt;As mentioned it is very classic issue I have seen. The first reference System/370 gx20-1850-3 (1976).&amp;nbsp; Just looking at &lt;A href="http://en.wikipedia.org/wiki/ISO_8859-1" title="http://en.wikipedia.org/wiki/ISO_8859-1"&gt;ISO/IEC 8859-1 - Wikipedia, the free encyclopedia&lt;/A&gt; (ascii) and notice the not being defined area's. That is different in the JAVA/Windows version.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="xis-paraSimple"&gt;Seeing you reference to IBM-037 codepoints 4A and AC you see the mentioned chars refered to extended ascii points. The not sign is not part of normal ascii. That is why you language (including SAS) having more options to that. If your bypass on reversing the ODBC&amp;nbsp; Ebcdic/Ascii is working for you fine. I would not trust that as generic approach.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 20:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190135#M35874</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-04-22T20:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190136#M35875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The mapping from EBCDIC -&amp;gt; ASCII and back again is not well defined.&amp;nbsp; Most mappings I have seen are not reversible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example how do we map the EBCDIC code 15 (which is intended as NL or NEW LINE) to ASCII?&amp;nbsp; There is not a direct equivalent.&amp;nbsp; Perhaps we should map it to the code for LF.&amp;nbsp; That makes good sense on a Unix system that uses LF as the end of line character in text files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are you actually trying to achieve?&amp;nbsp; Perhaps you would get better results using TRANSLATE function instead of the $EBCDIC format?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 22:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190136#M35875</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-22T22:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190137#M35876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Jaap for the link, some good stuff there.&amp;nbsp; I did use Trantab to update my syshelp.host translation tables, and when it did not solve my problem I googled some more and found, as you have indicated, they are used in file transfer, which I am not doing, so no help there.&amp;nbsp; I think I will just stick with my solution with the array, as it produces the correct result 100% of the time.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 02:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190137#M35876</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-23T02:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190138#M35877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It has been my experience that the S370/ebcdic formats behave differently over different SAS versions. One of our threads we opened with the SAS hotline even became a genuine error point in SAS 8.2 that lead to a fix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I solved the problem by applying a macro to all strings read from the host that uses the translate() function to correct the Umlauts and various other characters. When we migrated to 9.2 (on AIX), I had to insert a check for the system version, because in 9.2 the $ebcdic format already gave us the correct characters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 05:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190138#M35877</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-04-23T05:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190139#M35878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom, what I am doing is this:&amp;nbsp; pull out the packed decimal portions of a binary field, the structure of which, when converted to hex, is an array of elements each 14 characters long.&amp;nbsp; So, take this ebcdic hex string as an example...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C200000006377CD400000054318C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I import it through ODBC as binary, it looks like gobbledygook, but when converted to ebcdic hex it looks as above.&amp;nbsp; Knowing the structure of the data, I can take the packed decimal (6.2) portions and sum them to get the customers' account balance.&amp;nbsp; I have to lop off the first byte of each element first, the 'C2' and 'D4'.&amp;nbsp; So, in this case, it would be 63.77 (from the first element,C200000006377C) plus 543.18 (from the second element, D400000054318C) to get an account balance of 606.95.&amp;nbsp; The problem is that I have to first convert the binary to hex, which, since my machine is Windows, ends up being ascii hex.&amp;nbsp; So, the above ebcdic hex in ascii ends up being...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;420000008604404D000000E891F0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then have to take this ascii hex string and convert it to ebcdic hex.&amp;nbsp; That is where the missing values trip me up.&amp;nbsp; The easiest solution is to just use the DB2 HEX() function which would preclude me from having to do the conversion on my machine.&amp;nbsp; And this would make the most sense, since I would be letting the mainframe do what it is supposed to do.&amp;nbsp; My array solution also works like a charm.&amp;nbsp; I guess my curiosity in wanting to do it all on my machine is purely academic, just to see if it can be done.&amp;nbsp; Anyhow, I have a couple of solutions so I'll just stick with what works, and accept that there are limitations with round trip conversions between ebcdic and extended ascii.&amp;nbsp; Thank you all for taking a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 14:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190139#M35878</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-23T14:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190140#M35879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I still do not understand.&amp;nbsp; If you moved it as binary then just use an INFORMAT to read the binary string.&amp;nbsp; Why are you worrying about converting binary fields?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data xx ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input str $hex12. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = input(str,s370fpd6.2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; put str $hex12. +1 x ;&lt;/P&gt;&lt;P&gt;cards ;&lt;/P&gt;&lt;P&gt;00000006377D&lt;/P&gt;&lt;P&gt;00000054318C&lt;/P&gt;&lt;P&gt;00000060695C&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00000006377D -63.77&lt;/P&gt;&lt;P&gt;00000054318C 543.18&lt;/P&gt;&lt;P&gt;00000060695C 606.95&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 16:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190140#M35879</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-23T16:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190141#M35880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom, I believe It was first converted Ebcdic-Ascii by the ODBC interface and of that conversion (packed fields) needed to be translated back.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Binary is binary and at that level there not difference HEX-ascii or HEX-ebcdic. That story is giving me the impression of that additional conversion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 16:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190141#M35880</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-04-23T16:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190142#M35881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom, the field is an array of structured data.&amp;nbsp; So, the string 'C200000006377CD400000054318C' is two elements, each 7 bytes, with the first byte of each element representing a text account category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C2 00000006377C D4 00000054318C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'C2' represents a category of 'B' (ebcdic 'C2' = ascii '42' = 'B'), with the rest of that element being a packed decimal = 63.77.&amp;nbsp; The next element, starting at the 8th byte, is for category 'M' (ebcdic 'D4' = ascii '4D' = 'M'), with a packed decimal value of 543.18.&amp;nbsp; So, I need to lop off the first byte of each element in the field before I can convert the rest to a decimal value so I can sum them.&amp;nbsp; The DB2 field is 256 bytes, so it is possible for any one observation to have a string of 30 or more 7 byte elements that all need to be have the first byte lopped off then bytes 2 through 7 summed.&amp;nbsp; Is there a way to get rid of the first byte of each element without converting it to a hex string?&amp;nbsp; If so, that might be worth a try.&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 17:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190142#M35881</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-23T17:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190143#M35882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is moving your data as binary then you should not have any issue with any binary fields in your data.&amp;nbsp; For the text fields that odds of a value being in that field that is not translated "properly" is much smaller and usually not that serious an issue.&amp;nbsp; In the old days we had issues with {} and [] and some other punctuation characters.&amp;nbsp; But since we didn't put non-printing characters into text fields there was normally no major impact from having the values go through an EBCDIC to ASCII tanslation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your binary data is being "translated" then as long as the conversion is not mapping more than one value to the same value. (ie mapping both 15x and 25x&amp;nbsp; to LineFeed) then you should be abel to roll you own conversion tool.&amp;nbsp; P&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ut a test record into the database that is 256 characters long and has the values from 00x to FFx.&amp;nbsp; Pull it through the conversion and store it in a file.&amp;nbsp; Then use the translate function to convert the strings back to their original values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Try this example.&amp;nbsp; Compare the value you get with the dataset below with the values that you receive from pulling the data out of the database to see where your process is different than the what $EBCDIC format assumed would have happened.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data canary ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; converted=put(collate(0,256),$ebcdic256.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put converted $hex80.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if _n_=1 then set canary ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input string $20.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; new = translate(string,converted,collate(0,256));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put string $20. / string $hex40. / new $hex40. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1234567890ABCDEF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1234567890ABCDEF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3132333435363738393041424344454620202020&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;F1F2F3F4F5F6F7F8F9F0C1C2C3C4C5C640404040&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 17:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190143#M35882</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-23T17:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190144#M35883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So your example has fields of length 7 bytes. With the first byte being a character and the next 6 being packed decimal.&lt;/P&gt;&lt;P&gt;You can loop over you larger field and parse it into individual records.&lt;/P&gt;&lt;P&gt;Here is one example way using your sample value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data xx ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length field $256 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; field = 'C200000006377CD400000054318C'x ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; field = translate(field,'40'x,' ');&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length next $7 category $1 value 8 sum 8 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=0 by 1 until (category=' ');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; next = substr(field,1+i*7);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; category = input(next,$ebcdic1.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if category ne ' ' then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = input(substr(next,2),s370fpd6.2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum=sum(sum,value);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put i= next=$hex14. +1 category= +1 category $hex2. +1 value= 7.2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put sum=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i=0 next=C200000006377C&amp;nbsp; category=B&amp;nbsp; 42 value=63.77&lt;/P&gt;&lt;P&gt;i=1 next=D400000054318C&amp;nbsp; category=M&amp;nbsp; 4D value=543.18&lt;/P&gt;&lt;P&gt;i=2 next=40404040404040&amp;nbsp; category=&amp;nbsp;&amp;nbsp; 20 value=543.18&lt;/P&gt;&lt;P&gt;sum=606.95&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 18:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190144#M35883</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-23T18:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190145#M35884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let us keep it simple. When at the DB2 the records with their fields would have defined as separate fields being character and numeric ones, it was the ODBC / DB2 connection doing the translation.&lt;/P&gt;&lt;P&gt;As the problem is being introduced by referencing them as a combined field being first translated ebcdic-ascii it needed to be translated back into the original bytes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 18:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190145#M35884</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-04-23T18:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190146#M35885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Tom.&amp;nbsp; That is kind of what I am doing with my array solution posted at the start of the thread (although not nearly as elegantly as you have done).&amp;nbsp; That brings me back to my issue with ascii to ebcdic translations.&amp;nbsp; Take, for example, this one, which I have translated using my own array of ibm-037.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C200000008&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;15&lt;/STRONG&gt;&lt;/SPAN&gt;8CD500000003216C (this is what I need the resulting hex string to be)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I am getting the data as binary, I have to first convert it to hex (ascii), which gives me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4200000097&lt;STRONG style="text-decoration: underline;"&gt;85&lt;/STRONG&gt;F04E000000038125, which then has to be converted to ebcdic hex, and therein lies my problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice this(added spaces intentional) conversion when I use $ebcdic to convert the ascii hex to ebcdic..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4200000097 &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;85&lt;/STRONG&gt;&lt;/SPAN&gt; F04E000000038125 --&amp;gt;&amp;gt; C200000008 &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/SPAN&gt; 8CD500000003216C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything is fine except for the conversion of the '85'x to '25'x.&amp;nbsp; According to ibm-037, it should be converting to '15'x, so any fields that have a '85'x in them as ascii hex give the wrong answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did just speak to one of the mainframe guys who told me this field was designed to be fed into a COBOL function on the client 3270, converted to hex, then sliced and diced by the COBOL.&amp;nbsp; It was not intended for a direct manipulation by any other program.&amp;nbsp; Given that tidbit, however, I still think $ebcdic could work if I could just fix the mappings of the 8 errored characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 19:12:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190146#M35885</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-23T19:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190147#M35886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jaap, this is coming from one column in a DB2 table, not separate columns combined upon import.&amp;nbsp; I don't think anything is wrong with the odbc import, since I can, with 100% accuracy, turn the binary fields into the ebcdic hex they need to be, its just that I can't use a sas format to do it.&amp;nbsp; I have compared my ebcdic conversions to what I can get out of TSO on literally tens of millions of row without any errors.&amp;nbsp; I've been trying to get this to work for around 2 years now, and the only issue I can detect is the use of $ebcdic.&amp;nbsp; Anyhow, I sure appreciate all the help everyone has given me here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 19:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190147#M35886</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-23T19:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190148#M35887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am still confused about where the problem is being introduced.&amp;nbsp; Let me restate and you can tell me what I have done wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First let's use SAS notation and use hex literals ("hhhh"x)&amp;nbsp; to reference values that have been converted to hex so humans can read them and normal quoted strings ("fred")&amp;nbsp; for values that are the actual characters. (for example the three character string "123" would be stored in EBCDIC as the three byte string "F1F2F3"X and in ASCII as the string "313233"X )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say your database variable is named FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My understanding is that the data in the database is stored as BINARY. So for example the first 14 bytes of the 256 byte field is 'C200000008158CD500000003216C'X.&lt;/P&gt;&lt;P&gt;If this field is moved by your database connection as BINARY data then it will look exactly the same in SAS.&amp;nbsp; So if in SAS you used the $HEX format to look at the value (put field $hex28.;), then y&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ou would see in the log the 28 character string '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;C200000008158CD500000003216C' .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If that is the case then the code above should work without any issues.&amp;nbsp; There is no need to do anything within SAS to try and convert this binary field to or from ASCII.&amp;nbsp; (Other than if you want to interpret one or more of the bytes as EBCDIC characters as in the code above.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So let's assume that it is NOT the case. This means that your database connection does NOT allow you to move a field as binary and has instead imposed some type of transcoding on the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Now if SAS had done the conversion using the $ECBDIC informat (instead of your database connection software) then you would see in your log from the previous PUT statement a string like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;'420000000000F04E000000038125'.&amp;nbsp; Your string might be different as the conversion has been either done somewhere before SAS gets a hold of it or using some other component of SAS. In fact it better NOT match the string generated by the $EBCDIC. format because that format maps 28 different bytes to '00'x, as so it is NOT reversible. But as long as the translation that your database connect does use maps each possible byte is to a unique byte then you can reverse the translation by creating a translation table or string or whatever you want. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So if you are in this situation then you want to apply something like the TRANSLATE function to FIELD to convert it back to the BINARY data that it used to have ( that is back&amp;nbsp; to 'C200000008158CD500000003216C'X ) and then you can use the previous post to parse it into blocks and convert the text part to ASCII and the number part to numbers.&amp;nbsp; A good way to test that the translation is reversible is to fill a record in the database will all 256 possible byte values and pull it into SAS. This will also have the added benefit of generating the translation string that you will need to use to reverse the conversion.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Now if you cannot get that to work because the transcoding process is NOT reversible then you will need to find a way to convert the binary field to hex strings and copy that from the database into SAS.&amp;nbsp; For example in SAS I would use the PUT() function with the $HEX. format to convert a string into its hex equivalent.&amp;nbsp; I do not know what statement you would use on DB2 to do that.&amp;nbsp; So now once you have your now 512 character string into a SAS variable you can use the $HEX informat to convert it back to its original binary value.&amp;nbsp; So using the same 14 byte sequence this means that in DB2 you would convert the 14 byte string 'C200000008158CD500000003216C'x to the 28 byte string "C200000008158CD500000003216C".&amp;nbsp; Let's call this new variable HEXFIELD.&amp;nbsp;&amp;nbsp; This would then be copied into SAS without any issue as it will only be using 16 characters.&amp;nbsp; Then in SAS you could re-create FIELD by using ( field = input(hexfield,$hex28.) .&amp;nbsp; There is no need to reference any translation functions or arrays as you now have your actual binary strings back and can process them.&amp;nbsp; You might have some issue if your values are variable length.&amp;nbsp; But you can probably easily deal with that by either padding properly or also copying over a variable with the length.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 20:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190148#M35887</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-23T20:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190149#M35888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom, thank you so much for putting so much effort into understanding the issue.&amp;nbsp; I'm not sure if there is any transcoding going on in the odbc import, but you are exactly correct in your paragraph starting with '&lt;SPAN style="font-size: 10pt;"&gt;So let's assume that it is NOT the case'.&amp;nbsp; After importing, when I put the field into $hex format, I get the ascii string '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;420000000000F04E000000038125', and, even though I get errors when I try to put it to ebcdic hex, it is translated from the binary to ascii hex 100% correctly 100% of the time.&amp;nbsp; It seems odd that it cannot make the round trip conversion, but so it is.&amp;nbsp; Using your example field name of 'FIELD' in the DB2 table, the DB2 equivalent of $hex is the SQL function HEX().&amp;nbsp; In my odbc sql, I can do 'SELECT HEX(FIELD) FROM TABLE', and I get the correct ebcdic hex string 100% of the time.&amp;nbsp; I am going with your suggestion that the transcoding process may not be reversible, and I will have to live with my array solution, or use the HEX() function in my sql.&amp;nbsp; You've given me lots to think about, and if I make any progress, I'll post back to this thread.&amp;nbsp; Thank you again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Greg&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 22:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190149#M35888</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-04-23T22:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: $ebcdic missing 8 bytes with locale off</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190150#M35889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not think there is any need for you to worry about translation if you can get DB2 to convert to HEX and then convert back from HEX to binary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you perform this query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;connect to odbc (.....);&lt;/P&gt;&lt;P&gt;create table sasdata as &lt;/P&gt;&lt;P&gt;select input(hexfield,$hex512.) as field&lt;/P&gt;&lt;P&gt;from connection to odbc&lt;/P&gt;&lt;P&gt;(select hex(field) as hexfield from .... )&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you should have the data back as it was originally .&lt;/P&gt;&lt;P&gt;Then you could process the first 7 bytes using:&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sasdata;&lt;/P&gt;&lt;P&gt;&amp;nbsp; category = input(substr(field,1,1),$ebcdic1.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; value = input(substr(field,2,6),s370fpd6.2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 22:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ebcdic-missing-8-bytes-with-locale-off/m-p/190150#M35889</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-23T22:44:34Z</dc:date>
    </item>
  </channel>
</rss>

