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



As a minimum I think you will have to run the SQL through the toolkit interface - your PHP and toolkit are probably in different jobs.

Have you read through this page? http://yips.idevcloud.com/wiki/index.php/XMLService/XMLSERVICEConnect

It seems to me you will need a persistent connection for the toolkit work - without that each request could be a different job.

As I said way back I would not use QTEMP - too many complications. If you don’t want to change the record layout to include an Id then why not use the concept of having your own “TEMP” library and create a file with a unique name? The only requirement in addition to your QTEMP solution would be that you would either have to DROP the table after use or alternatively run a nightly clean up job or something.

Has to be less work than wrestling with QTEMP and minimal coding changes - just change the lib name and maybe add a drop.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 11, 2016, at 12:18 PM, Roche, Bob <broche@xxxxxxxxxxxxxxxxx> wrote:

I already have a connection to the local database. I am using that connection resource. The connection defined in the connection object is not stateful, but I do not need to save state between page builds.

$ToolkitServiceObj = ToolkitService::getInstance($conn_obj->getConn_res())

Then I set params using the plant code as the key. This was passed in to the call from another page.

$ToolkitServiceObj->setToolkitServiceParams(array(
'InternalKey' => "/tmp/$plant",
'plug' => "iPLUG32K"
));

Create the file in qtemp

// run cl command to create file
$cmd = "CRTDUPOBJ OBJ(FILENAME) FROMLIB(PRODUCTION) TOLIB(QTEMP) OBJTYPE(*FILE)";
try {
$ToolkitServiceObj->CLCommand($cmd);
} catch (Exception $e) {
$cmd = "clrpfm file(QTEMP/FILENAME)";
$ToolkitServiceObj->CLCommand($cmd);
echo $e->getMessage(), "\n";
}

Similar code to override to the file.

Call the work file build program.
$param[] = $ToolkitServiceObj->AddParameterChar('BOTH', 3, 'PLANT', 'PLANT', $plant);

$result = $ToolkitServiceObj->PgmCall("PROGRAMNAME", " ", $param, null, null);

Then I try to use SQL to access the file.
$sql = "Select * from QTEMP/FILENAME order by FIELD1, FIELD2";

The DB2_prepare complains the file does not exist in qtemp.

Since multiple users can use this I thought this would be best way to handle the work file. The current display does it this way so the program was already there for me to use.

-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Friday, November 11, 2016 10:44 AM
To: Web400@Midrange. Web400 <web400@xxxxxxxxxxxx>
Subject: Re: [WEB400] PHP and RPG, work file question

What does your toolkit connection look like? How did you define it?


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 11, 2016, at 11:32 AM, Roche, Bob <broche@xxxxxxxxxxxxxxxxx> wrote:


I have the basics working, at this point it is the override to QTEMP giving me the issue. IFI skip the override for testing purposes, I can clear the file member and call the program to build the work file. I'm guessing the disconnect is in the call to the toolkit. I get no errors from the toolkit, but when I try to pull the data the file does not exist in qtemp. Is this because my PHP job and the toolkit job are in separate actual jobs? After building the work file using the toolkit, how do I access the data? Just Using SQL in my function is not working. I've been looking online for an example of this, but I have yet find one. My web page works fine, as long as I don't reference qtemp.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.midrange.com
_mailman_listinfo_web400&d=DgICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6M
Svd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=SbEmT_Px9d6T
XKjPc8VsFGHEGhsGiDZpRQ6771151sA&s=2oSG1fZBQcuVSnQAITp2qIf3-IMZsr4wyUJl
XJ8lR78&e=
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=http-3A__archive.midrange.com_web400&d=DgICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=SbEmT_Px9d6TXKjPc8VsFGHEGhsGiDZpRQ6771151sA&s=IEJf7oQnNn0ZeV-8DZ62owszBcI3RNKa3u-DUu8du2c&e= .


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.midrange.com_mailman_listinfo_web400&d=DgICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=SbEmT_Px9d6TXKjPc8VsFGHEGhsGiDZpRQ6771151sA&s=2oSG1fZBQcuVSnQAITp2qIf3-IMZsr4wyUJlXJ8lR78&e=
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=http-3A__archive.midrange.com_web400&d=DgICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=SbEmT_Px9d6TXKjPc8VsFGHEGhsGiDZpRQ6771151sA&s=IEJf7oQnNn0ZeV-8DZ62owszBcI3RNKa3u-DUu8du2c&e= .

--
This is the Web Enabling the IBM i (AS/400 and 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-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.