Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EBCDIC Converter?

0 views
Skip to first unread message

p...@de.ibm.com

unread,
Jan 7, 1998, 3:00:00 AM1/7/98
to

Hi Folks,

does there exist any library to convert ASCII to EBCDIC and EBCDIC to
ASCII?

Thanks

Patrick Steiner

Chris Marriott

unread,
Jan 8, 1998, 3:00:00 AM1/8/98
to

In article <ufn2h8s...@torres.bs.boeblingen.ibm.com>, p...@de.ibm.com
writes

>does there exist any library to convert ASCII to EBCDIC and EBCDIC to
>ASCII?

For goodness sake, why do you need a "library"? Just use a lookup table!

Chris

----------------------------------------------------------------
Chris Marriott, Microsoft Certified Solution Developer.
SkyMap Software, U.K. e-mail: ch...@skymap.com
Visit our web site at http://www.skymap.com

iand

unread,
Jan 12, 1998, 3:00:00 AM1/12/98
to p...@de.ibm.com

p...@de.ibm.com wrote:
>
> Hi Folks,

>
> does there exist any library to convert ASCII to EBCDIC and EBCDIC to
> ASCII?
>
> Thanks
>
> Patrick Steiner

Patrick,

Gee, I would have thought IBM would have at least one or two of those
around somewhere ;)

Here's an EBCDIC to ASCII translation table, expressed in Pascal. It's
just an array lookup, so you can express it in whatever language you're
using.

Cheers

-- Ian

const ebcdic : ebcdic_array = (
{00} #$00, #$01, #$02, #$03, #$00, #$09, #$ff, #$7f,
{08} #$00, #$00, #$00, #$0b, #$0c, #$0d, #$0e, #$0f,
{10} #$10, #$11, #$12, #$13, #$00, #$0d, #$08, #$00,
{18} #$18, #$19, #$00, #$00, #$1c, #$1d, #$1e, #$1f,

{20} #$00, #$00, #$00, #$00, #$00, #$0a, #$17, #$1b,
{28} #$00, #$00, #$00, #$00, #$00, #$05, #$06, #$07,
{30} #$00, #$00, #$16, #$00, #$00, #$00, #$00, #$04,
{38} #$00, #$08, #$00, #$00, #$14, #$15, #$00, #$1a,

{40} #$20, #$20, #$83, #$84, #$85, #$a0, #$61, #$86,
{48} #$87, #$a4, #$63, #$2e, #$3c, #$28, #$2b, #$21,
{50} #$26, #$82, #$88, #$89, #$8a, #$a1, #$8c, #$8b,
{58} #$8d, #$e1, #$21, #$24, #$2a, #$29, #$3b, #$5e,

{60} #$2d, #$2f, #$41, #$8e, #$41, #$41, #$41, #$8f,
{68} #$80, #$00, #$7c, #$2c, #$25, #$5f, #$3e, #$3f,
{70} #$00, #$90, #$45, #$45, #$45, #$49, #$49, #$49,
{78} #$49, #$60, #$3a, #$23, #$40, #$27, #$3d, #$22,

{80} #$00, #$61, #$62, #$63, #$64, #$65, #$66, #$67,
#$68, #$69, #$00, #$7b, #$00, #$28, #$2b, #$00,
{90} #$f8, #$6a, #$6b, #$6c, #$6d, #$6e, #$6f, #$70,
#$71, #$72, #$00, #$a7, #$91, #$29, #$92, #$00,

{A0} #$2d, #$7e, #$73, #$74, #$75, #$76, #$77, #$78,
#$79, #$7a, #$00, #$00, #$00, #$5b, #$00, #$2e,
{B0} #$30, #$31, #$32, #$33, #$34, #$35, #$36, #$37,
#$38, #$39, #$00, #$00, #$00, #$5d, #$23, #$2d,

{C0} #$7b, #$41, #$42, #$43, #$44, #$45, #$46, #$47,
{c8} #$48, #$49, #$ca, #$93, #$94, #$95, #$a2, #$6f,
{D0} #$7d, #$4a, #$4b, #$4c, #$4d, #$4e, #$4f, #$50,
{d8} #$51, #$52, #$00, #$96, #$81, #$97, #$a3, #$00,

{e0} #$5c, #$00, #$53, #$54, #$55, #$56, #$57, #$58,
{e8} #$59, #$5a, #$00, #$4f, #$99, #$4f, #$4f, #$4f,
{f0} #$30, #$31, #$32, #$33, #$34, #$35, #$36, #$37,
{f8} #$38, #$39, #$7c, #$55, #$9a, #$55, #$55, #$7f);

0 new messages