1825711 Members
3139 Online
109686 Solutions
New Discussion

Convert file to EBCDIC

 
Srinikalyan
Regular Advisor

Convert file to EBCDIC

Hi,
I have one requirement to convert a file(majorly ASCII and some mixed Binary data) to EBCDIC. I used dd command dd if=asciifile of=ebcdicfile conv=ebcdic. By doing this, all the ascii data converted to ebcdic. But I need to preserve my Binary data while doing this. I just want to convert ASCII data to EBCDIC by leaving the binary as it is. Can anyone help me to achieve this?

Thanks,
Srini
6 REPLIES 6
Hemmetter
Esteemed Contributor

Re: Convert file to EBCDIC

Hi Srini,

you have to dissect you file into ascii and binary parts by some logic and process them individually and then recombine them.

But with no idea about the nature of your files no better suggestions can be made.

rgds
HGH
Patrick Wallek
Honored Contributor

Re: Convert file to EBCDIC

Not possible with dd. dd will convert everything in the file.

I would question have mixed ASCII and binary data in the same file anyway.

I think it would be better to split the file into 2 parts. 1 part ASCII and the other part the binary data. Once split, you can convert the ASCII to EBCDIC and then concatenate the files back together.
Srinikalyan
Regular Advisor

Re: Convert file to EBCDIC

HGH,
Currently our system is Mainframes which is producing the file that would be normally EBCDIC format and that file will be send to external system i.e. also Mainframe through FTP binary mode. So no issues in interpreting the file. Now the sending system is going to change to UNIX so that file format will be ASCII instead of EBCDIC. If we send the file through binary mode, everything will be corrupted.If it through ASCII, Only ascii data will be preserved and not the binary data. Since it is the system migration i.e. from mainframe to UNIX, we haven't bothered abt this thing.
OldSchool
Honored Contributor

Re: Convert file to EBCDIC

"Since it is the system migration i.e. from mainframe to UNIX, we haven't bothered abt this thing."

I'm not sure what you're trying to say with the above.

You really need to:
a) Split the file into separate binary / text info.
b) Be aware that the "binary" information may not be usable due to differences in processor architecture (endian issues, word size and I suppose others).

The interfacing mechanism between the two boxes needs to be better thought out, it appears
Ragav Krishnan
New Member

Re: Convert file to EBCDIC

All the ASCII data are coverted to EBCDIC and the file is transferred in Binary.This preserves the ASCII and Binary data.But now we are not able to distinguish end of record as the record lengths are varying.
Bill Hassell
Honored Contributor

Re: Convert file to EBCDIC

This is a classic mainframe problem. The programmers have intermixed binary and text in the same record and are also using one of the many variable length formats. There is no solution possible without writing a program -- after you study the mainframe file types and get a field definition listing. Only the mainframe program knows what data is located in each field position.


Bill Hassell, sysadmin