×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
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.
As an Amazon Associate we earn from qualifying purchases.
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.