BookmarkSubscribeRSS Feed
gsnidow
Obsidian | Level 7

Here you go.  I copied it from my program editor into here, then copied it from here back to the editor to make sure it kept it's format, and it worked.  Thanks.

array ascii_ebcdic {2,256} $

  (

  '00' '01' '02' '03' '04' '05' '06' '07' '08' '09' '0A' '0B' '0C' '0D' '0E' '0F' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '1A' '1B' '1C' '1D' '1E' '1F' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '2A' '2B' '2C' '2D' '2E' '2F' '30' '31' '32' '33' '34' '35' '36' '37' '38' '39' '3A' '3B' '3C' '3D' '3E' '3F' '40' '41' '42' '43' '44' '45' '46' '47' '48' '49' '4A' '4B' '4C' '4D' '4E' '4F' '50' '51' '52' '53' '54' '55' '56' '57' '58' '59' '5A' '5B' '5C' '5D' '5E' '5F' '60' '61' '62' '63' '64' '65' '66' '67' '68' '69' '6A' '6B' '6C' '6D' '6E' '6F' '70' '71' '72' '73' '74' '75' '76' '77' '78' '79' '7A' '7B' '7C' '7D' '7E' '7F' '80' '81' '82' '83' '84' '85' '86' '87' '88' '89' '8A' '8B' '8C' '8D' '8E' '8F' '90' '91' '92' '93' '94' '95' '96' '97' '98' '99' '9A' '9B' '9C' '9D' '9E' '9F' 'A0' 'A1' 'A2' 'A3' 'A4' 'A5' 'A6' 'A7' 'A8' 'A9' 'AA' 'AB' 'AC' 'AD' 'AE' 'AF' 'B0' 'B1' 'B2' 'B3' 'B4' 'B5' 'B6' 'B7' 'B8' 'B9' 'BA' 'BB' 'BC' 'BD' 'BE' 'BF' 'C0' 'C1' 'C2' 'C3' 'C4' 'C5' 'C6' 'C7' 'C8' 'C9' 'CA' 'CB' 'CC' 'CD' 'CE' 'CF' 'D0' 'D1' 'D2' 'D3' 'D4' 'D5' 'D6' 'D7' 'D8' 'D9' 'DA' 'DB' 'DC' 'DD' 'DE' 'DF' 'E0' 'E1' 'E2' 'E3' 'E4' 'E5' 'E6' 'E7' 'E8' 'E9' 'EA' 'EB' 'EC' 'ED' 'EE' 'EF' 'F0' 'F1' 'F2' 'F3' 'F4' 'F5' 'F6' 'F7' 'F8' 'F9' 'FA' 'FB' 'FC' 'FD' 'FE' 'FF'

  '00' '01' '02' '03' '37' '2D' '2E' '2F' '16' '05' '25' '0B' '0C' '0D' '0E' '0F' '10' '11' '12' '13' '3C' '3D' '32' '26' '18' '19' '3F' '27' '1C' '1D' '1E' '1F' '40' '5A' '7F' '7B' '5B' '6C' '50' '7D' '4D' '5D' '5C' '4E' '6B' '60' '4B' '61' 'F0' 'F1' 'F2' 'F3' 'F4' 'F5' 'F6' 'F7' 'F8' 'F9' '7A' '5E' '4C' '7E' '6E' '6F' '7C' 'C1' 'C2' 'C3' 'C4' 'C5' 'C6' 'C7' 'C8' 'C9' 'D1' 'D2' 'D3' 'D4' 'D5' 'D6' 'D7' 'D8' 'D9' 'E2' 'E3' 'E4' 'E5' 'E6' 'E7' 'E8' 'E9' 'BA' 'E0' 'BB' 'B0' '6D' '79' '81' '82' '83' '84' '85' '86' '87' '88' '89' '91' '92' '93' '94' '95' '96' '97' '98' '99' 'A2' 'A3' 'A4' 'A5' 'A6' 'A7' 'A8' 'A9' 'C0' '4F' 'D0' 'A1' '07' '20' '21' '22' '23' '24' '15' '06' '17' '28' '29' '2A' '2B' '2C' '09' '0A' '1B' '30' '31' '1A' '33' '34' '35' '36' '08' '38' '39' '3A' '3B' '04' '14' '3E' 'FF' '41' 'AA' '4A' 'B1' '9F' 'B2' '6A' 'B5' 'BD' 'B4' '9A' '8A' '5F' 'CA' 'AF' 'BC' '90' '8F' 'EA' 'FA' 'BE' 'A0' 'B6' 'B3' '9D' 'DA' '9B' '8B' 'B7' 'B8' 'B9' 'AB' '64' '65' '62' '66' '63' '67' '9E' '68' '74' '71' '72' '73' '78' '75' '76' '77' 'AC' '69' 'ED' 'EE' 'EB' 'EF' 'EC' 'BF' '80' 'FD' 'FE' 'FB' 'FC' 'AD' 'AE' '59' '44' '45' '42' '46' '43' '47' '9C' '48' '54' '51' '52' '53' '58' '55' '56' '57' '8C' '49' 'CD' 'CE' 'CB' 'CF' 'CC' 'E1' '70' 'DD' 'DE' 'DB' 'DC' '8D' '8E' 'DF'

  );

Linlin
Lapis Lazuli | Level 10

Do you want to attach file? if so you can click the "Use advanced editor " on the top right corner.

Tom
Super User Tom
Super User

There are 8 characters where the translations in your matrix is different than the $EBCDIC format from SAS.  (see list below)

Find some example values in your data that use these characters and see which translation tables convert them to the proper value (readable by S370FPD6.2 format).

0B want=25  ebcdic=15

5C want=BA  ebcdic=AD

5E want=BB  ebcdic=BD

5F want=B0  ebcdic=5F

86 want=15  ebcdic=25

A9 want=BD  ebcdic=BB

AD want=5F  ebcdic=B0

DE want=AD  ebcdic=BA

Tom
Super User Tom
Super User

Here are those strings in a little more usable format. 

from =

  '000102030405060708090A0B0C0D0E0F'x

||'101112131415161718191A1B1C1D1E1F'x

||'202122232425262728292A2B2C2D2E2F'x

||'303132333435363738393A3B3C3D3E3F'x

||'404142434445464748494A4B4C4D4E4F'x

||'505152535455565758595A5B5C5D5E5F'x

||'606162636465666768696A6B6C6D6E6F'x

||'707172737475767778797A7B7C7D7E7F'x

||'808182838485868788898A8B8C8D8E8F'x

||'909192939495969798999A9B9C9D9E9F'x

||'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x

||'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x

||'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x

||'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x

||'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x

||'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x

;

to=

  '00010203372D2E2F1605250B0C0D0E0F'X

||'101112133C3D322618193F271C1D1E1F'X

||'405A7F7B5B6C507D4D5D5C4E6B604B61'X

||'F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F'X

||'7CC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6'X

||'D7D8D9E2E3E4E5E6E7E8E9BAE0BBB06D'X

||'79818283848586878889919293949596'X

||'979899A2A3A4A5A6A7A8A9C04FD0A107'X

||'202122232415061728292A2B2C090A1B'X

||'30311A333435360838393A3B04143EFF'X

||'41AA4AB19FB26AB5BDB49A8A5FCAAFBC'X

||'908FEAFABEA0B6B39DDA9B8BB7B8B9AB'X

||'6465626663679E687471727378757677'X

||'AC69EDEEEBEFECBF80FDFEFBFCADAE59'X

||'4445424643479C485451525358555657'X

||'8C49CDCECBCFCCE170DDDEDBDC8D8EDF'X

;

gsnidow
Obsidian | Level 7

Tom, thank you so much for your insight.  I'm grabbing at straws here, but I read a little about the translation tables, and used ...

proc trantab table=ebcdic;

list both;

run;

The results are very different from what I would expect.  The first table below is what SAS produced as table 1, and the second table below is what I would expect the table to have looked like.  The way I am interpreting this is that for ascii values '00'x - '7F'x the two outputs are identical.  However, everything after that is completely different from what I need.  My questions are, am I looking at the right thing?  Is the first table below what SAS is using to translate when the $ebcdic format is used?  If not, how can I see the table being used for $ebcdic?  Can I make a custom table and have it be the default for my machine?  Also, I apologize for the way it looks, as I could not figure out how to keep the formatting as you have done above.  Thank you.

 

0 1 2 3 4 5 6 7 8 9 A B C D E F

00 '00010203372D2E2F1605250B0C0D0E0F'x

10 '101112133C3D322618193F271C1D1E1F'x

20 '405A7F7B5B6C507D4D5D5C4E6B604B61'x

30 'F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F'x

40 '7CC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6'x

50 'D7D8D9E2E3E4E5E6E7E8E9ADE0BD046D'x

60 '79818283848586878889919293949596'x

70 '979899A2A3A4A5A6A7A8A9C04FD0A107'x

80 '0608090A1415171A1B20212223242829'x

90 '2A2B2C30313334353638393A3B3E4142'x

A0 '43444A4546476A48495152535F545556'x

B0 '57585962636465666768697071727374'x

C0 '75767778808A8B8C8D8E8F909A9B9C9D'x

D0 '9E9FA0AAABACAEAFB0B1B2B3B4B5B6B7'x

E0 'B8B9BABBBCBEBFCACBCCCDCECFDADBDC'x

F0 'DDDEDFE1EAEBECEDEEEFFAFBFCFDFEFF'x

   0 1 2 3 4 5 6 7 8 9 A B C D E F

00 '00010203372D2E2F1605250B0C0D0E0F'x

10 '101112133C3D322618193F271C1D1E1F'x

20 '405A7F7B5B6C507D4D5D5C4E6B604B61'x

30 'F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F'x

40 '7CC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6'x

50 'D7D8D9E2E3E4E5E6E7E8E9BAE0BBB06D'x

60 '79818283848586878889919293949596'x

70 '979899A2A3A4A5A6A7A8A9C04FD0A107'x

80 '202122232415061728292A2B2C090A1B'x

90 '30311A333435360838393A3B04143EFF'x

A0 '41AA4AB19FB26AB5BDB49A8A5FCAAFBC'x

B0 '908FEAFABEA0B6B39DDA9B8BB7B8B9AB'x

C0 '6465626663679E687471727378757677'x

D0 'AC69EDEEEBEFECBF80FDFEFBFCADAE59'x

E0 '4445424643479C485451525358555657'x

F0 '8C49CDCECBCFCCE170DDDEDBDC8D8EDF'x

gsnidow
Obsidian | Level 7

A little update here.  I found out how to use trantab to create the custom table and it's inverse that I would need to use.  I am still not sure if this is what I need to do, nor of how to have the $ebcdic format use the table (which I have called ascebc)  in my sasuser.profile.  Boy, this thread sure did go off course, but I sure do appreciate all the wonderful help I've been getting.  Thank you all so much.

Greg

Tom
Super User Tom
Super User

You can read in the translation tables by using the CATALOG filename engine.  Compare the log for these two steps.

filename xx catalog 'sashelp.host.ebcdic.trantab';

data _null_;

  infile xx  ;

  input (x01-x16) ( $char16.);

  put _n_=  / (x01-x16) (= $hex32. /) / ;

run;

proc trantab table=ebcdic;

  list both ;

run; quit;

gsnidow
Obsidian | Level 7

Ok, I had looked in there earlier this morning, and there is no ebcdic entry in sashelp.host.  I get this error...

 

ERROR: Entry EBCDIC.TRANTAB not found in catalog SASHELP.HOST.

However, I was able to view the ebcdic translation tables using proc trantab, so it must be somewhere, I just can't find it.  Just to make sure I was looking in the correct place, I replaced ebcdic with ascii, which is in my sashelp.host, in your filename statement above, and it worked as it should.

gsnidow
Obsidian | Level 7

I found syshelp.host.asciebcd which seems to contain the same data as ebcdic.


FriedEgg
SAS Employee

Greg,

Try reviewing this usage note on packed decimal fields in DB2: http://support.sas.com/kb/32/742.html

I would not recommend using the hex() function in DB2 since, as you are aware, SAS will obfuscate the information.

gsnidow
Obsidian | Level 7

Thank you for pointing that out FriedEgg.  As Tom's post indicates, we may have an issue of which we were unaware.

Greg

Ksharp
Super User

Maybe you can use TRANTAB Procedure +

performing transport-format translations when you transfer files with the CPORT

and CIMPORT procedures

to translate character from EBCDIC to ASCII  .

Ksharp

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 26 replies
  • 5034 views
  • 6 likes
  • 5 in conversation