Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EBCDIC to ASCII Conversion

 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks promising.
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! but compilation throws an error at the the followin line String thisCharSet = Config.getCharSet();
any idea?
Ram
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
James Chegwidden
Author
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to this conversion??
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ram,
The Config class is part of the servlet API. Just make sure that you import it correctly.
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Monty!
I will try this and keep you posted.
Ram
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic