Operating System - HP-UX
1825139 Members
5067 Online
109679 Solutions
New Discussion

Convert ascii to ebcdic in HPUX using dd

 
ashanabey
Advisor

Convert ascii to ebcdic in HPUX using dd

Hi,

I am try to convert ASCII file to MVS EBCDIC format using the dd cmd.

Out put file comes with grebe.

dd if=convert.txt of=CONVERT conv=ebcdic

Text file is contain of below info
000234999
345543678
123345678


out put comes like this
--
bepdr:/ashan # cat CONVERT
òóô÷öõô÷ò%òóô÷öõô÷õ%òóô÷öõôøö%òóô÷öõöòñ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%bepdr:/ashan #

Please any one know how to fix this problem

Thx!
Ashan

legend the heart and lend the hand
2 REPLIES 2
Tim Nelson
Honored Contributor

Re: Convert ascii to ebcdic in HPUX using dd

What are you expecting the output to be ?

The dd is doing what you told it to.
A. Clay Stephenson
Acclaimed Contributor

Re: Convert ascii to ebcdic in HPUX using dd

A couple of things are at play in your case. 1) You did not specify a cbs (conversion buffer size) so the default size was used. This results in padding being added to the output. 2) cat is a lousy tool to use when non-ASCII data is being displayed.

Use od (or xd) to examine your output file.

e.g.

xd -Ad -v -txC myfile

which will display the hexadecimal equivalent for each byte.

Man dd and xd for details.
If it ain't broke, I can fix that.