General discussion on Zend Server for IBM System i


Postby russcraig on 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
<table width="75%" border="1" cellspacing="1" cellpadding="1" bgcolor="#eeeeee">
<tr> <td><b> Code</b></td> </tr>

//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");

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

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

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


Postby chris_hird on 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?

Shield Advanced Solutions Ltd
Home of JobQGenie and the Receiver Apply Program
Posts: 171
Joined: Fri Apr 10, 2009 12:41 am
Location: Toronto


Postby russcraig on 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?

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


Postby r_engelhardt on Thu Oct 28, 2010 7:42 pm

Zend Server HTTP Config?

CgiConvMode %%MIXED/MIXED%%
Posts: 4
Joined: Fri Oct 08, 2010 12:11 am


Postby darkluke980 on Sat Oct 30, 2010 11:27 am


what is the value of SetEnv="CCSID=xxx" in your www/zendsvr/conf/fastcgi.conf?
Posts: 61
Joined: Sat Mar 28, 2009 8:31 pm
Location: Italy


Postby zend_i5 on 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
Posts: 158
Joined: Mon Mar 23, 2009 5:22 pm


Postby papdog on 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

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.
Posts: 4
Joined: Mon Jul 25, 2011 5:04 pm


Postby erich_hieden on 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.

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


Postby papdog on Wed Jul 27, 2011 12:19 pm

Thank you Erich
Posts: 4
Joined: Mon Jul 25, 2011 5:04 pm

Return to Zend Server for IBM i

Who is online

Users browsing this forum: No registered users and 1 guest