Call a CL program from inside php program

The place for general PHP questions and hints for PHP on IBM i

Call a CL program from inside php program

Postby ronhextall on Thu Aug 09, 2012 5:19 pm

I would like to call a CL program with an input parameter or two from within a php program. We are running ZendCore and use db2_connect and db2_execute to query and update files on the iSeries all the time so a connection should be the problem.

Just would like a nice clean example from beginning to end on how to do it.

Thanks.
ronhextall
 
Posts: 24
Joined: Fri Jan 27, 2012 10:03 pm

Re: Call a CL program from inside php program

Postby kentatzend on Thu Aug 09, 2012 6:05 pm

So ... first you really should consider moving to Zend Server. We end-of-lifed Core about 2 years ago ... so you are way out of date wrt technology like PHP version, bug fixes, etc.

Second, you should take a look at the toolkit we've added to Zend Server. I think it can do what you want ...
User avatar
kentatzend
 
Posts: 1778
Joined: Thu Dec 11, 2008 1:08 pm

Re: Call a CL program from inside php program

Postby ronhextall on Thu Aug 09, 2012 6:16 pm

We are getting a new machine in the next year so we will upgrade everythign than I am told.

Is there no hope until than?
ronhextall
 
Posts: 24
Joined: Fri Jan 27, 2012 10:03 pm

Re: Call a CL program from inside php program

Postby ronhextall on Thu Aug 09, 2012 7:36 pm

This link provides an excellent example and it worked fine, outside some minor syntax issues.

http://www.sematopia.com/2006/09/php-on ... s/?print=1
ronhextall
 
Posts: 24
Joined: Fri Jan 27, 2012 10:03 pm

Re: Call a CL program from inside php program

Postby kentatzend on Fri Aug 10, 2012 3:53 pm

First, Zend Core had an older version of a toolkit to allow calls to IBM i CL programs and functions. We have discontinued that in favor of this newer version developed jointly by IBM and Zend but you could start start with that older versino to get stuff running and later during the transition change a few lines and move to the new toolkit. Try to keep your CL calls isolated into one file/function so it's easy to swap out if you can.
Second, I'm not 100% certain but it might even be possible given the nature of the new toolkit that it could be made tow ork on Zend Core. Maybe some of the more toolkit knowledgeable people have more thoughts.
User avatar
kentatzend
 
Posts: 1778
Joined: Thu Dec 11, 2008 1:08 pm

Re: Call a CL program from inside php program

Postby aseiden on Sun Aug 12, 2012 5:17 am

With Zend Core (past end-of-life, as Kent said), the old toolkit will work; the new toolkit should also work, so long as Zend Core's older version of ibm_db2 handles CLOBs well enough.
aseiden
 
Posts: 804
Joined: Thu Apr 09, 2009 5:45 pm

Re: Call a CL program from inside php program

Postby chrisbirk on Mon Oct 29, 2012 2:11 am

There is a real easy way. Go and set up a dummy table and put a trigger on it, that is the cl command you want to have run. Insert a dummy record and it will fire the trigger and that will call the cl command, etc.

It is fast and works.
chrisbirk
 
Posts: 8
Joined: Fri Oct 12, 2012 11:03 pm


Return to PHP Questions / Hints

Who is online

Users browsing this forum: Google [Bot] and 1 guest