Hi Cyndi,

Did you ever get this working with those "other files"?

Since I wrote "The IBM i Programmer's Guide to PHP" with my co-conspirator
Kevin, I am always interested in hearing what people thought of it and how
it helped them.

Let me know.

Thanks,
Jeff Olen
jmo@xxxxxxxxxxxx


On Tue, Aug 25, 2009 at 8:16 AM, Cyndi Bradberry <CyndiB@xxxxxxxx> wrote:

Hi, I figured out part of my problem with the php script. The files I
was trying to access are too Old !
The script from "The IBM I Programmer's Guide to PHP", page 246 simply
retrieves the library/file name and then lists the names of the columns
(fields).

<?php
//Set the database name
$tableName = 'FILENAME' ;
$libName = 'LIBRARY' ;

//Create the connection to the System i Relational Database
if (($dbh = db2_connect('SYSTEM','USERID','PASSWORD')) === false) {
echo 'connection failed.<br>' ;
echo db2_conn_errormsg().'<br>' ;
die() ;
}

//Retrieve a result set with the column info for the
//file specified at the top of the script.
if (($cols = db2_columns( $dbh, null, $libName, $tableName, '%' )) ===
FALSE) {
echo 'colums retrieval failed. <BR>' ;
echo db2_stmt_errormsg(). '<BR>' ;
die() ;
}

//Fetch the first row and output the file name
// and library name from the result set.
$column = db2_fetch_assoc($cols) ;
echo 'FileTable: ' ;
echo $column["TABLE_SCHEM"]."/".$column["TABLE_NAME"]."<BR>" ;

//Loop thru all the result set rows and list all the column names.

do {
echo $column["COLUMN_NAME"]."<BR>" ;
} while ($column = db2_fetch_assoc($cols)) ;

?>

Some files however, would not share their column information. I wouldn't
even get the name of the file or the library ! In talking to another
programmer, he said that some files could not be accessed via ODBC. When
I tried the files he had problems with the same thing happened.

HOWEVER, if you copy the file to another library or even the same
library using a different name, it suddenly becomes visible to the php
script and to odbc. CPY and CRTDUPOBJ both seem to work, not rgzpfm or
chgpf. The files that are difficult are older files on our system,
generally created before 2000.

Is this something anyone else has come across ? Is there a PTF I should
be looking for ? We are on an 810 at V5R4.
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.