aspose file tools*
The moose likes Java in General and the fly likes EBCDIC  to ASCII Conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "EBCDIC  to ASCII Conversion" Watch "EBCDIC  to ASCII Conversion" New topic
Author

EBCDIC to ASCII Conversion

ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Hello,
I have a string(in EBCDIC), wants to know how to convert it into ASCII using java
kinldy let me know
Ram
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
This looks promising.


"JavaRanch, where the deer and the Certified play" - David O'Meara
ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Thanks! but compilation throws an error at the the followin line String thisCharSet = Config.getCharSet();
any idea?
Ram
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8764
    
    5
I don't have any ideas but I'm delighted to hear that EBCDIC is still around - haven't heard that acronym for 14 years!


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
James Chegwidden
Author
Ranch Hand

Joined: Oct 06, 2002
Posts: 201
Why would you want to this conversion??


Author and Instructor, my book
ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
I have some japanese characters stored in DB2 tables on mainframe OS/390. I need to read the data thru java programs running( on websphere) on solaris .. DB2 for OS/390 verson 6 stores the data in EBCDIC and when that data has been brought to solaris it needs to be converted into ASCII
Kindly let me know if you have any idea?
Thanks
Ram
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
If you are using websphere to connect to db2.
The data conversion should be done for you by db2 connect and/or the jdbc driver. Before it gets to java. If the data conversion is not happening. Please check your db2 cli configuration. This is a very simple change. 5 to 10 minutes tops.
I will be watching football this after-noon.
If you are still having problems on monday.
I will send you the changes you need to make.
Fyi, please use db2 cca to make these changes.
...
Data configuration happens on both the os390 and your solaris client.
...
You have come to the right plase for i am a db2 developer, dba, specializing in application and engine configuration and tuning on NT, UNIX, and MVS platforms.
[ November 24, 2002: Message edited by: Monty Ireland ]

Multi Platform Database Developer & DBA on E.S.T.
ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Thanks a lot Monty!
I got so disappointed trying to resolve this .. now I am so happy and excited to see your reply!
Could you please help me out first set this working on WEBSPHERE on Windows NT first then I will try to implement this SOLARIS.
I have Websphere 3.5.4 running on Windows NT 4.0
and it has DB2 UDB version 7.0 installed on it ( for WAS ) I will be running a servlet from this NT machine which will go to the Mainframe OS 390 ( DB for os/390 version 7) read a DB2 table which has data which has been loaded after coverting from ASCII to EBCDIC using iconv utility
Here is the code snippet from my servlet:

Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection connection=DriverManager.getConnection;
("jdbc b2:AAAADB2P","userID","Password");

String sqlStatement =" SELECT X_DESC " +
" FROMS.LTABLE " +
" WHEREC_LANG_WW = ? ";
PreparedStatement preparedStatement = connection.prepareStatement(sqlStatement);
preparedStatement.setString(1, "JAPANESE");
ResultSet resultSet = preparedStatement.executeQuery();

while (resultSet.next()){
String data = resultSet.getString("X_DESC").trim();
}
Then I wanted to send the string data to an HTML page on the browser. I already configured Internet exlorer for japanese language.
Kinldy let me know what should I do now on my Windows NT side first then we can go from there.
Your help is highly appreciated! Once again thanks a lot for your help!
Thanks
Ram
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
ram,
The Config class is part of the servlet API. Just make sure that you import it correctly.
ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Thanks Cindy.
But looks like I don't have to do any conversion on java side as per Monty.
Thanks for your time and help!
I am waiting to here from Monty. I will keep every one posted as soon as my problem is resolve!
Once again thanks.
Ram
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
Sorry for the delay.
FYI, I know nothing about WEBSPHERE.
The DB2 driver you are using should be using DB2 CLI when connecting to DB2 on and OS390.
The default CLI setting for DBCS are turnd off.
Because most people do not need DBCS.
I have never used these CLI settings before.
Here is what I think you need to do:
1. open db2 cca
2. highlight the db2 alias you want to change
3. select properities ans settings
4. select the data type tab
5. select graphics
6. select both check box's
You may need to re-bind... i am not sure...
It will not hurt.
That's it...
Let me know how your testing goes.
For all others...
DB2 CCA is a vendor provider database alias configuration tool used by ODBC & DB2 CLI.
DB2 data conversion happens at both the client and server levels.
Example:
machine a sends data (sql query) to machine b
- data conversion (ascii to ebcdic) happens at machine b
machine b sends data (answer set) to machine a
- data conversion (ebcdic to ascii) happens at machine a
DBCS translations happen at machine a before it gets to the java code.
Let me know if this is not so!
And I will dig deaper in the IBM documentation.
Hope this helps.
ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Thanks a lot Monty!
I will try this and keep you posted.
Ram
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EBCDIC to ASCII Conversion
 
Similar Threads
ebcdic to ascii
ASCII TO EBCDIC: how ?
Code conversions
Charset with US-ASCII
Character encoding