× 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.



In addition to the i5 toolkit suggestion... the most recent versions of the ibm_db2 driver has an option as well:

$conn = db2_pconnect("","","", array("i5_naming"=>DB2_I5_NAMING_ON,
"i5_libl"=>"QGPL QTEMP IESMTFIL"));

I have to admit, though, I've had trouble getting this i5_libl option to work -- I wonder if I'm not using a new enough version of the ibm_db2 driver.

Another approach (that seems to work consistently for me) is turning the QCMDEXC API into a stored procedure...

CREATE PROCEDURE QGPL/QCMDEXC (
IN CMDLINE CHAR(32702) ,
IN LENGTH DECIMAL(15, 5) )
LANGUAGE CL
NOT DETERMINISTIC
NO SQL
EXTERNAL NAME 'QSYS/QCMDEXC'
PARAMETER STYLE GENERAL

Once you've done that, you'll be able to easily call QCMDEXC as a stored procedure, and you can use it to run the addlible command. I have the following PHP routine that I will include into my scripts:

function db_addlible($conn, $lib, $pos) {
$cmd = "ADDLIBLE LIB(" . $lib . ") POSITION(" . $pos . ")";
$sql = "CALL QSYS/QCMDEXC('" . $cmd . "', " . strlen($cmd) .")";
if (!db2_exec($conn, $sql))
return FALSE;
return TRUE;
}

With that, I can simply do:

$conn = db2_connect(...etc...);
db_addlible($conn, "ACCTLIB" "*LAST");

I tend ignore the errors from this, since often times the library is already in the library list, so it fails :)


elehti@xxxxxxxxxxxxxxxxxx wrote:
Our web developer hard-codes library name (library.table) on each SQL
statement because he does not know how to change a job library list
(INLLIBL parameter (Initial Library List) on the job description.)

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.