Page 1 of 1

Library list issues

Posted: Fri Apr 13, 2018 10:22 pm
by longnoz

We typically use db2_connect and pass a set of libraries in the i5_libl paramater. This works perfectly for our db2_exec commands (ie simple SQL)
$db = db2_connect($serial_no,strtoupper($_SERVER['PHP_AUTH_USER']),strtoupper($_SERVER['PHP_AUTH_PW']),array('i5_libl' => 'LIBERTU SFALIBR QS36F', 'i5_naming' => DB2_I5_NAMING_ON));

But when we use the toolkit, we are having trouble understanding how the LIBL is working. We use the following command in what we believe is an attempt to re-use the same connection we have used for db2_exec commands:
$obj = ToolkitService::getInstance($db);

Yet in order to successfully call our service program function by means of a PgmCall command, we are obliged to rebuild our library list using a bunch of calls to CLCommand(addlible...) .
$result = $obj->PgmCall($program, $library , $param, $retParam, array('func'=>'StockAvailable') );

It is at this link that we were led to believe we could re-use the existing DB connection: ... ctions.htm


Re: Library list issues

Posted: Tue May 08, 2018 4:19 pm
by aseiden

Best way to set up a liblist is via the user profile's job description, but what you did should work also. If you want the toolkit job to use the database connection to run programs in, you'll need to specify stateless mode.

Code: Select all

Try it.

Alan Seiden

Re: Library list issues

Posted: Wed May 09, 2018 2:18 pm
by longnoz

We already had $obj->setOptions(array('stateless'=>true));

Upon further investigation, I noted that the program in question was implementing the toolkit in a function. The DB connection was not set as a global variable in the function, so the function was not seeing DB connection.

Actually, it is not entirely true that the function was not seeing the database connection. It was able to connect to the database, it just seems that the LIBL portion of the DB connection was not visible to the function, which seems odd.

In any case, the problem is solved now