[comp.unix.ultrix] EBCDIC to ASCII conversion under ULTRIX

HASKINS@MAINE.BITNET (Robert D. Haskins) (08/28/90)

Does anyone know how to convert a file that is in EBCDIC format to ASCII
format?  Is there a command/program to do this under UNIX/ULTRIX ?  If not,
does anybody know of a public domain program to do the conversion?
 
Thanks,
!bob

sandee@sun16 (Daan Sandee) (08/29/90)

In article <90240.091342HASKINS@MAINE.BITNET> HASKINS@MAINE.BITNET (Robert D. Haskins) writes:
>Does anyone know how to convert a file that is in EBCDIC format to ASCII
>format?  Is there a command/program to do this under UNIX/ULTRIX ?  If not,
>does anybody know of a public domain program to do the conversion?

RTFM for cryssake. 
            dd conv=ascii        <infile >outfile
On  Ultrix-32 V3.1B.

Daan Sandee                                           sandee@sun16.scri.fsu.edu
Supercomputer Computations Research Institute
Florida State University, Tallahassee, FL 32306-4052  (904) 644-7045

omerzu@quando.quantum.de (Thomas Omerzu) (08/29/90)

In article <90240.091342HASKINS@MAINE.BITNET>
HASKINS@MAINE.BITNET (Robert D. Haskins) writes:

>Does anyone know how to convert a file that is in EBCDIC format to ASCII
>format?  Is there a command/program to do this under UNIX/ULTRIX ?  If not,
>does anybody know of a public domain program to do the conversion?


Well, maybe you can use the 'dd'-command.
The option
	conv=ascii    converts EBCDIC to ASCII
wereas
	conv=ebcdic   converts ASCII to EBCDIC 


Bye,
	Thomas.
-- 
*-----------------------------------------------------------------------------*
Thomas Omerzu      UUCP:     ...!unido!quando!omerzu / omerzu@quando.uucp
  Quantum GmbH,    Bitnet:   UNIDO!quando!omerzu / omerzu%quando@UNIDO(.bitnet)
Dortmund, Germany  Internet: omerzu@quando.quantum.de

felps@convex.com (Robert Felps) (08/29/90)

HASKINS@MAINE.BITNET (Robert D. Haskins) writes:

>Does anyone know how to convert a file that is in EBCDIC format to ASCII
>format?  Is there a command/program to do this under UNIX/ULTRIX ?  If not,
>does anybody know of a public domain program to do the conversion?
> 
>Thanks,
>!bob

Does ULTRIX support dd?
For information on dd: man dd
A possible command   : dd if=infile of=outfile conv=ascii

Hope ULTRIX has dd!

Robert 
--
Robert Felps                                Tech. Assistant Ctr
Convex Computer Corp                        OS System Specialist
3000 Waterview Parkway                      felps@convex.com
Richardson, Tx.  75083                      1(800) 952-0379

chris@mimsy.umd.edu (Chris Torek) (08/29/90)

>In article <90240.091342HASKINS@MAINE.BITNET> HASKINS@MAINE.BITNET
 (Robert D. Haskins) asks for EBCDIC => ASCII conversion.

In article <1694@quando.quantum.de> omerzu@quando.quantum.de
 (Thomas Omerzu) suggests using `dd':
>	conv=ascii    converts EBCDIC to ASCII

Unfortunately, while there is only one ASCII (or two if you count the old
non-standard version with arrows where [\]_ appear in modern ASCII), there
are very many different (and incompatible) EBCDICs.  Take any two pieces
of IBM hardware that support more than the `basic' EBCDIC set (upper &
lower case, digits, and a few special symbols) and they will not use the
same table.  Square brackets on one will turn into hats on another.%
Backslashes will vanish.  Some IBM equipment can even display characters
it cannot generate!  (I know of no instances of the reverse, which is not
to say that they do not exist.)

So, the first problem with EBCDIC to anything conversion is to figure out
exactly which EBCDIC is being used. . . .
-----
% Actually, I am not sure what usually maps to what, but the characters []
  {} \ and ^ are the biggest trouble spots.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

art@pilikia.pegasus.com (Art Neilson) (08/30/90)

In article <90240.091342HASKINS@MAINE.BITNET> HASKINS@MAINE.BITNET (Robert D. Haskins) writes:
>Does anyone know how to convert a file that is in EBCDIC format to ASCII
>format?  Is there a command/program to do this under UNIX/ULTRIX ?  If not,
>does anybody know of a public domain program to do the conversion?

This is really easy to write in C, just declare a static array of 256
unsigned chars and initialize it with the numeric values of the ASCII
characters.  Make sure the array position corresponds to the EBCDIC value
as you will use the EBCDIC value as the indice into the array, like so:

/* etoa.c */

#include <stdio.h>

typedef unsigned char byte;

static byte ascii[256] = {
	initializers, 
	go,
	here,
};

main()
{
	int c;

	while ((c = getchar()) != EOF) 
		putchar(ascii[c]);
}

I can mail you both the ASCII and EBCDIC array declarations
if you need them.
-- 
Arthur W. Neilson III		| ARPA: art@pilikia.pegasus.com
Bank of Hawaii Tech Support	| UUCP: uunet!ucsd!nosc!pegasus!pilikia!art

rickert@mp.cs.niu.edu (Neil Rickert) (08/30/90)

In article <1990Aug29.184831.1216@pilikia.pegasus.com> art@pilikia.pegasus.com (Art Neilson) writes:
>In article <90240.091342HASKINS@MAINE.BITNET> HASKINS@MAINE.BITNET (Robert D. Haskins) writes:
>>Does anyone know how to convert a file that is in EBCDIC format to ASCII
>>format?  Is there a command/program to do this under UNIX/ULTRIX ?  If not,
>>does anybody know of a public domain program to do the conversion?
>
>This is really easy to write in C, just declare a static array of 256
>unsigned chars and initialize it with the numeric values of the ASCII
>characters.  Make sure the array position corresponds to the EBCDIC value
>as you will use the EBCDIC value as the indice into the array, like so:
>
 Before implementing this program, you might check to see if the options
available on the 'dd' command are suitable for the intented purposes.
-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115.                                  +1-815-753-6940

gwyn@smoke.BRL.MIL (Doug Gwyn) (08/30/90)

In article <90240.091342HASKINS@MAINE.BITNET> HASKINS@MAINE.BITNET (Robert D. Haskins) writes:
>Does anyone know how to convert a file that is in EBCDIC format to ASCII
>format?  Is there a command/program to do this under UNIX/ULTRIX ?

"dd" does this; RTFM.
Unfortunately, there are multiple notions of EBCDIC encoding and the one
that "dd" implements may not be 100% what you want, although it should be
quite close.

dave@ecrc.de (Dave Morton) (08/30/90)

In article <26264@mimsy.umd.edu>, chris@mimsy.umd.edu (Chris Torek) writes:
|>>In article <90240.091342HASKINS@MAINE.BITNET> HASKINS@MAINE.BITNET
|> (Robert D. Haskins) asks for EBCDIC => ASCII conversion.
|>
|>So, the first problem with EBCDIC to anything conversion is to figure out
|>exactly which EBCDIC is being used. . . .
|>-----
|>% Actually, I am not sure what usually maps to what, but the characters []
|>  {} \ and ^ are the biggest trouble spots.

Yes indeed. It's even worse. I think they also have country specific
EBCDIC codes. I ran into this problem years ago with a System 34 here
in Germany.
                         
Dave Morton, 
European Computer Industry Research Centre      Tel. + (49) 89-92699-139
Arabellastr 17, 8000 Munich 81. West Germany.	Fax. + (49) 89-92699-170
dave@ecrc.de

guy@auspex.auspex.com (Guy Harris) (09/02/90)

> Before implementing this program, you might check to see if the options
>available on the 'dd' command are suitable for the intented purposes.

Unfortunately, ssome of the other suggestions didn't bother suggesting
doing this check first.  From the SunOS 4.0.3 DD(1) (but they all work
this way, and the manuals should all say this):

     cbs is used only if ascii, unblock, ebcdic,  ibm,  or  block
     conversion  is specified.  In the first two cases, cbs char-
     acters are placed into the conversion buffer, any  specified
     character  mapping is done, trailing blanks trimmed and NEW-
     LINE added before sending the line to the  output.   In  the
     latter  three cases, characters are read into the conversion
     buffer, and blanks added to make up an output record of size
     cbs.

so that the "ascii" and "ebcdic" and "ibm" options are for converting
between ASCII lines (NL at the end, UNIX lines) and EBCDIC *card
images*.  This may or may not be what the original poster wanted....