Thanks for the ideas and I will check out that page. I'm new to PHP and this is my first time using the toolkit. Most of our RPG program are still large monolithic programs so I didn’t think I would use too many RPG calls. But the idea of not reinventing something that already works is why I went this route. I also have not done much work with other databases, so creating my own TEMP library sounded like more work than I thought this way would be. I was trying to use the current programming as is, so I would not need to adjust even more code on the current system just to add this to the new system. I'm going to try running the SQL thru to the toolkit first because everything else works at this point.

Maybe this is why I could not find any samples of this online. It's not the way to do this, even if it does sound simple coming from CL/RPGLE viewpoint.

Thanks

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

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? https://urldefense.proofpoint.com/v2/url?u=http-3A__yips.idevcloud.com_wiki_index.php_XMLService_XMLSERVICEConnect&d=DgIGaQ&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=zmktXW0f_H2tn9S36B4wmm3md3CT0j0eKEB6ziAYVDU&s=LxmVl0Jjvc5QzrPuySmoi9_HW67ek0NLjHeEPNKTxiU&e=

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.co
m
_mailman_listinfo_web400&d=DgICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6
M
Svd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=SbEmT_Px9d6
T
XKjPc8VsFGHEGhsGiDZpRQ6771151sA&s=2oSG1fZBQcuVSnQAITp2qIf3-IMZsr4wyUJ
l
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_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=DgIGaQ&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6M
Svd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=zmktXW0f_H2t
n9S36B4wmm3md3CT0j0eKEB6ziAYVDU&s=I6VLv_hxFn6izUtrfblu_wffH9hl9VwF-wS_
2W8makw&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=DgIGaQ&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=zmktXW0f_H2tn9S36B4wmm3md3CT0j0eKEB6ziAYVDU&s=HsAjm3JWAI-rkIN5lRsQ2nyxQ_WBViLkReiQu-Fu638&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=DgIGaQ&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=zmktXW0f_H2tn9S36B4wmm3md3CT0j0eKEB6ziAYVDU&s=I6VLv_hxFn6izUtrfblu_wffH9hl9VwF-wS_2W8makw&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=DgIGaQ&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=zmktXW0f_H2tn9S36B4wmm3md3CT0j0eKEB6ziAYVDU&s=HsAjm3JWAI-rkIN5lRsQ2nyxQ_WBViLkReiQu-Fu638&e= .


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