CCSID's

General discussion on Zend Server for IBM System i
Post Reply
russcraig
Posts: 2
Joined: Mon Oct 11, 2010 10:07 pm

CCSID's

Post by russcraig » Mon Oct 11, 2010 10:11 pm

Hi All, first post!

I recently downloaded and installed ZendServer for IBM i. Everything is working great so far, but when I go to pull data from our database and display it on the webpage, it seems it's not converting from EBCDIC to ASCII. Here is the sample program I am working with:

Code: Select all

<html>
<table width="75%" border="1" cellspacing="1" cellpadding="1" bgcolor="#eeeeee"> 
<tr> <td><b> Code</b></td> </tr> 
 
<?php 
//Establish connection to database  
$conn = db2_connect ("*LOCAL", "", ""); 
$query = "Select * from RECLIB.OPNQINP"; 
          
//Execute query 
$queryexe = db2_exec($conn, $query) ; 
//Fetch results 

while(db2_fetch_row($queryexe)) { 
 $data = db2_result($queryexe, 'OPNQINP'); 
//Put the results in an HTML table. 
print("<tr bgcolor=#ffffff>\n"); 
print("<td>$data</td>\n"); 
print("</tr>\n"); 
} 
?>
</table>
</html>
Here is the contents of the file OPNQINP:

Code: Select all

00100This is test record 1
00200This is test record 2
00300This is test record 3
00400This is test record 4
00500This is test record 5
This is the output I receive on the webpage:

Code: Select all

Code 
ððñðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ñ@@@@@@@@@@@@@@@@@@@@@@@@ 
ððòðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ò@@@@@@@@@@@@@@@@@@@@@@@@ 
ððóðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ó@@@@@@@@@@@@@@@@@@@@@@@@ 
ððôðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ô@@@@@@@@@@@@@@@@@@@@@@@@ 
ððõðð㈉¢@‰¢@£…¢£@™…ƒ–™„@õ@@@@@@@@@@@@@@@@@@@@@@@@ 

Is there a simple way to have it convert from EBCDIC to ASCII?

Thanks.

chris_hird
Posts: 171
Joined: Fri Apr 10, 2009 12:41 am
Location: Toronto
Contact:

Re: CCSID's

Post by chris_hird » Tue Oct 12, 2010 9:11 pm

It should be converted to ASCII automatically and you should not have to do anything? Looks like the CCSID's are messed up either with the web server of the file? What are the CCSID's you have setup for the webserver and what CCSID are the pages in? I had a particularly bad experience where I copied an existing IBM page that showed perfectly well when it was straight HTML, but when I renamed it to .php and it ran through the interpreter it was all garbled! This may be what you are seeing?

Chris...
Shield Advanced Solutions Ltd
Home of JobQGenie and the Receiver Apply Program
http://www.shield.on.ca/Blog

russcraig
Posts: 2
Joined: Mon Oct 11, 2010 10:07 pm

Re: CCSID's

Post by russcraig » Wed Oct 13, 2010 6:00 pm

Figured out what my problem was: The file I was trying to access was CCSID 65535. I simply created a new table selecting the records I wanted from the original, while explicitly setting its CCSID to 37. I then used the new table for output to the webpage. Are there any other methods to convert CCSID 65535?

Thanks.

r_engelhardt
Posts: 4
Joined: Fri Oct 08, 2010 12:11 am

Re: CCSID's

Post by r_engelhardt » Thu Oct 28, 2010 7:42 pm

Zend Server HTTP Config?
/www/zendsvr/conf/httpd.conf

CgiConvMode %%MIXED/MIXED%%

darkluke980
Posts: 61
Joined: Sat Mar 28, 2009 8:31 pm
Location: Italy
Contact:

Re: CCSID's

Post by darkluke980 » Sat Oct 30, 2010 11:27 am

Hi,

what is the value of SetEnv="CCSID=xxx" in your www/zendsvr/conf/fastcgi.conf?

zend_i5
Posts: 158
Joined: Mon Mar 23, 2009 5:22 pm

Re: CCSID's

Post by zend_i5 » Sun Nov 14, 2010 1:37 pm

DB2 SQL requires setting CCSID other than 65535 in order to convert data from EBCDIC to ASCII and visa versa. You have two options to do that:
1. Change QCSSID system value to 37. This way all users and jobs will use correct CCSID
2. Add the following line to Apache configuration file /www/zendsvr/con/httpd.conf :
DefaultFsCCSID 37
This way all Zend Server Apache jobs will have correct CCSID for DB2 process

papdog
Posts: 4
Joined: Mon Jul 25, 2011 5:04 pm

Re: CCSID's

Post by papdog » Mon Jul 25, 2011 5:11 pm

I am sorry to tag along an older post, but I felt my question would be best qualified here.
We have a new install of zend server on our iSeries.
I am having difficulty displaying database information on a web page when the data description for a file has fields defined with CCSID of 65535.
I have tried adding these two lines to our /www/zendsvr/conf/httpd.conf file:

DefaultFsCCSID 37
CGIJobCCSID 37

However, the fields defined with CCSID of 65535 still display on the web page as EBCDIC like ÓÖÃÕ@@@@@@ (or equivalent).

Would someone be able to assist me? Do I need to address each field in my SQL statements as a CAST, or should the conf file be enough?

Thank you in advance.

erich_hieden
Posts: 393
Joined: Tue Jul 07, 2009 9:01 am

Re: CCSID's

Post by erich_hieden » Tue Jul 26, 2011 7:59 am

We had a similar problem, but we had the field CCSIDs set to 273 and the QCCSID was 65535. We opted for changing the QCCSID to 1141 (it's the same as 273, only with the euro sign). Now it runs like a charm.

In your case I don't know of any way the httpd.conf file could help you, but please prove me wrong. CASTing each field in SQL should work AFAIK, but tends to be tiresome. IMHO I'd change the field CCSID to 37, it may be the bigger change at first but pays off in the long run.

Regards

papdog
Posts: 4
Joined: Mon Jul 25, 2011 5:04 pm

Re: CCSID's

Post by papdog » Wed Jul 27, 2011 12:19 pm

Thank you Erich

Post Reply