Article View: comp.protocols.ibm
Article #1082Re: SOS: C Routines for ASCII to EBCDIC Conversion and Vice-versa
From: Daniel A. Graifer
Date: Fri, 21 Jun 1991 19:19
Date: Fri, 21 Jun 1991 19:19
32 lines
2147 bytes
2147 bytes
In article <1991Jun20.115613.13073@mp.cs.niu.edu> rickert@mp.cs.niu.edu (Neil Rickert) writes:
>In article <1991Jun19.190752.28034@ssdc.honeywell.com> satya@ssdc.honeywell.com (Satya Prabhakar) writes:
>>uses EBCDIC. I am looking for C routines that convert ASCII strings
>>into EBCDIC strings and vice-versa. We need these DESPERATELY and
>
> I don't understand. What is wrong with a simple loop replacing
>c with EBCDIC[c] for each char c in the string of unsigned chars.
>Something like:
> while(*p) { *p = EBCDIC[*p]; p++;}
>
> You do need to initialize your table. Pick up the tables used on the
>3090 and use those. If you don't like that choice build your own in
>the grand tradition of mutual inconsistency which currently exists in
>the ASCII <-> EBCDIC translation world.
I wrote a two line c program to output chars0-256, and
piped this through dd -ascii and od -c to create my
table. This way, the table is at least consistant with
what dd produces. Note that the table produced this way
will not necessarily be invertable. (But then neither
are the mainframe translate tables. If I recall my
Burroughs B[67]000 days correctly (now Unisys A-Series),
the translation of ASCII "!" was not invertable. And
you may have a real problem with the >100 EBCDIC chars
that aren't meaningful.
Dan
--
Daniel A. Graifer Coastal Capital Funding Corp.
Sr. Vice President, Financial Systems 7900 Westpark Dr. Suite A-130
(703)821-3244 McLean, VA 22102
uunet!fciva!dag fciva.FRANKCAP.COM!dag@uunet.uu.net
Technical Details
Message-ID:
<611@fciva.FRANKCAP.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!fciva!dagReferences:
<1991Jun19.190752.28034@ssdc.honeywell.com> <1991Jun20.115613.13073@mp.cs.niu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!fciva!dag From: dag@fciva.FRANKCAP.COM (Daniel A. Graifer) Newsgroups: comp.protocols.ibm,comp.protocols.iso,comp.protocols.tcp-ip,comp.unix.questions Subject: Re: SOS: C Routines for ASCII to EBCDIC Conversion and Vice-versa Message-ID: <611@fciva.FRANKCAP.COM> Date: 21 Jun 91 19:19:11 GMT References: <1991Jun19.190752.28034@ssdc.honeywell.com> <1991Jun20.115613.13073@mp.cs.niu.edu> Reply-To: dag@fciva.UUCP (Daniel A. Graifer) Organization: Coastal Capital Funding Corp., McLean, VA Lines: 32