Unable to convert EBCDIC file to ASCII file

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Unable to convert EBCDIC file to ASCII file
# 1  
Old 04-19-2013
Unable to convert EBCDIC file to ASCII file

Hello all,

To give you all a little bit of background. We recently migrated from HP-UX to Redhat Linux and one of the command I used to run on HP-UX to convert an EBCDIC file to ASCII file isn't working on Linux. The code is as follow:

Code:
 
cat workout2.dat | dd cbs=250 conv=block conv=ascii > ofr1.txt

The code executes without any error on Linux, however, the output is nowhere close to what it used to produce on HP-UX.

One other interesting thing is that I used the option cbs=250 to convert 250 bytes at a time, as the record length consists of 250. But now on Linux it only produces 250 Bytes of file with this option. If I remove this option then also the output is messed up.

Note: I referred to other similar threads. But couldn't get the final answer. So please dont refer me to other link unless and until you're sure that it contains a final answer.


Greatly appreciate any response which can lead to a solution!


- Seth
# 2  
Old 04-19-2013
When I read your thread title, the first thing jumping to my mind was dd. This failing, did you consider recode or iconv, both of which should be available on the linux platform?
# 3  
Old 04-19-2013
Both iconv and dd are available on Redhat and can convert from EBCDIC to ASCII.
# 4  
Old 04-19-2013
Translating EBCDIC isn't trivial unfortunately. The Linux version of dd just does a blind character-to-character remapping which misses some of EBCDIC's finer subtleties... I can't remember the details but something to do with the order of digits in extended numbers. iconv would do a much better job.

Last edited by Corona688; 04-19-2013 at 01:59 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check if file is EBCDIC or ASCII format

So, i have this requirement where i need to check the file format, whether it's EBCDIC or ASCII, and based on format retrieve the information from that file: my file is: file1.txt-->this ebcdic file file2.txt-->ascii file i tried below code: file=file1.txt type="`file $file`" i get... (7 Replies)
Discussion started by: gnnsprapa
7 Replies

2. UNIX for Beginners Questions & Answers

Convert EBCDIC(.DAT) FILE into ASCII FILE

Hi Team, I am having 100 EBCDIC files (i.e. DAT extension) and need to convert them into ASCII File by unix shell script. I tried with DD Command but its not providing output as expected. Sample Text: ------------------ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Expected Output:... (2 Replies)
Discussion started by: JSM
2 Replies

3. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies

4. Shell Programming and Scripting

Convert UTF-8 file to ASCII/ISO8859-1 OR replace characters

I am trying to develop a script which will work on a source UTF-8 file and perform one or more of the following It will accept the target encoding as an argument e.g. US-ASCII or ISO-8859-1, etc 1. It should replace all occurrences of characters outside target character set by " " (space) or... (3 Replies)
Discussion started by: hemkiran.s
3 Replies

5. Programming

Ebcdic to ascii

Hi, I want to convert ebcdic values to ascii values. Are there anyany specific c++ libraries with g++ compiler, which can do it ? gcc version 4.1.2 20080704 (Red Hat 4.1.2-54) (19 Replies)
Discussion started by: tostay2003
19 Replies

6. Shell Programming and Scripting

How to check if the file has EBCDIC or ascii characters

Hi, is there a way to check if the initial few characters are ebcdic or ascii in a file? (1 Reply)
Discussion started by: ahmedwaseem2000
1 Replies

7. Shell Programming and Scripting

convert file to ascii

I have a file in below format(ISO ) and to be convert to readable (.txt/Ascii) format .send me the commands/code please sample as follows 2043010101167157001190002010011120000000002144300000000000000000000 01022_ - %rE@ U...ug  47 56   d %rE@ 01022_ - $5 fy ... (1 Reply)
Discussion started by: nalakaatslt
1 Replies

8. UNIX for Dummies Questions & Answers

How to convert ebcdic file to ascii file?

How to convert ebcdic file to ascii file? (1 Reply)
Discussion started by: superuser123
1 Replies

9. Shell Programming and Scripting

How to convert ebcdic file to ascii file?

How to convert ebcdic file to ascii file? (1 Reply)
Discussion started by: superuser123
1 Replies

10. Shell Programming and Scripting

How to convert English text file to ASCII File?

file abc abc: English text I want to convert the above into file abc file: ascii text (1 Reply)
Discussion started by: laknar
1 Replies
Login or Register to Ask a Question