• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating an EBCDIC file

 
milan doshi
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need to generate an EBCDIC file. The file will also have binary images embedded in it.

Can someone tell me how do I convert a Java String to EBCDIC and generate a file which has EBCDIC data ?

Thanks in advance,
Milan
 
Paul Clapham
Sheriff
Posts: 21862
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just like ASCII, there's a lot of varieties of EBCDIC. The commonest one corresponds to the "Cp037" encoding in Java. So to write String data to a file in EBCDIC you would do something like this:As for the binary images, I have no idea how you would do that. If you really have to do it (and it sounds like a bad idea to me), you would first have to find out whether they were supposed to be encoded in any way. I would guess they wouldn't, but then there might be more bad ideas involved here. If there is EBCDIC text mixed with binary data then don't use the first example. Instead something like this:
 
milan doshi
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul !

Thats a very helpful reply. The probelem seems to be much less complex than I what originally perceived . Yes, we will be using Cp037.

As far as images are concernmed, I need to embedd the BINARY image in the generated file.

So it's time for me to try out your suggestions...

Thanks again!
Milan
 
milan doshi
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more clarification is sought:

Would such a conversion require any special handling for any characters ? So when I am generating an EBCDIC file, will it require special handling for any character(next line etc) ?

I know that most probably this is a NON Issue but I thought of clarifying it while I am in design stage.

Thanks again!
 
Paul Clapham
Sheriff
Posts: 21862
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see why there would be special handling for any characters. The whole point of charsets in Java is to convert Unicode data to and from specified encodings. If special handling were required, the charset should be doing that special handling anyway.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!