Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert a EBCDIC file to ASCII?

Status
Not open for further replies.

praise12

IS-IT--Management
Mar 17, 2002
17
US
Hey all,
Is there any way to convert a data file with EBCDIC format to ASCII in Unix? Any advice would be appreciated.
Thanks...
 
Here's a message thread that may help you.

thread209-27959

The actual conversion is beyond my expertise.
You may try posting this in a main frame forum as well.

Robert Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
My basic understanding is that ftp should work
in the ascii mode as long as the source data
is character data and not packed data.

Robert Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
praise12:

While I've never had cause to use it, the dd command has an option to perform EBCDIC/ASCII conversions. Here's a section from man dd:

conv=value[,value...]
Where values are comma-separated symbols from the following list:

ascii Convert EBCDIC to ASCII.

asciib Convert EBCDIC to ASCII

Regards,

Ed
Schaefer
 
Thanks for all the responses, I'll try!!
 
Hi,

Note, when using "dd conv=ascii" to translate from ebcdic to ascii, if the record of your file are sperated by new-line character, the new-lines are also converted !!! Jean Pierre.
 
You're absolutely right, is there any other way to fix it?
Thanks...
 
praise12:

I'm still thinking about this one, but I think you're going to have to look at each character and not convert it if it's a new line.

The dd command might be able to help you because it has block size and count options:

dd bs=1 count=1

I'll be interested in what you finally develop.

Regards,

Ed
Schaefer
 
Hi,

If your file contains only printable characters, you can try :

tr '\n' '\000' < file.ebcdic | dd conv=ascii 2> /dev/null | tr '\000' '\n' > file.ascii

In fact, it's ok if the null is not in your file.
Don't convert binary datas from ebcdic to ascii. Jean Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top