PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on...
Transcript of PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on...
![Page 1: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/1.jpg)
© All rights reserved. Zend Technologies, Inc.
PHP on IBM i RPG Examples
Mike Pavlak
Solution Consultant
![Page 2: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/2.jpg)
© All rights reserved. Zend Technologies, Inc.
Agenda
•Open Source Toolkit
•RPG Program Calls
•Stored Procedures
•Q&A
2
![Page 3: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/3.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server 7 for IBM i
Key Features
Z-Ray (Like Firebug for PHP)
Server Dashboards
Code libraries
Much more!
3
![Page 4: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/4.jpg)
© All rights reserved. Zend Technologies, Inc.
RPG Examples
www.zend.com
Introduction to PHP
![Page 5: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/5.jpg)
© All rights reserved. Zend Technologies, Inc.
PHP is a Scripting Language PHP Hypertext Pre-Processor
Developed initially by Rasmus Lerdorf in 1994: PHP/FI
Zeev Suraski and Andi Gutmans Contributing since1997+ (ZEev + aNDi = Zend)
Interpreted, not compiled
Forgiving and intuitive code structure (Short learning curve)
Immediate feedback during development
PHP is to Java what RPG is to COBOL
| 5 Geting Started with PHP on IBM i
![Page 6: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/6.jpg)
© All rights reserved. Zend Technologies, Inc.
What Is Zend Server? • Production quality PHP stack
PHP, ZF, DB connectivity, debugging extension, and more
• Three Editions – No charge “Basic Edition” provided by IBM & Full Professional and Enterprise commercial edition
All are production ready
• Application monitoring and diagnostics (integrated with Zend Studio)
• Multi-level performance enhancement capabilities
• Software updates and security hot fixes
• Easy and quick installation
• Zend Framework Integration
| 6 Geting Started with PHP on IBM i
![Page 7: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/7.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server
Zend Server Under the Covers
HTTP:10080 Apache Server (FastCGI)
IBM i
i/OS
DB2 UDB
PHP CGI
PHP file PASE
*PGM
CMD
ILE Apache:10080 • Default
configuration FastCGI
URL Request
HTML/response
| 7 Geting Started with PHP on IBM i
MySQL, SQL Server,
Oracle
![Page 8: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/8.jpg)
© All rights reserved. Zend Technologies, Inc.
Sample Scripts! (http://IBMi:10080/samples )
| 8 Geting Started with PHP on IBM i
![Page 9: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/9.jpg)
© All rights reserved. Zend Technologies, Inc. | | 9 Geting Started with PHP on IBM i
![Page 10: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/10.jpg)
© All rights reserved. Zend Technologies, Inc.
Sample Script – Hello World • Obligatory program when starting out
• Confirms correct setup of PHP
• Sample code: (Shortest PHP Macro around!)
• Save script in IFS /www/zendsvr6/htdocs /helloworld.php
• Browser URL: http://ibmisystem:10080/helloworld.php
| 10 Geting Started with PHP on IBM i
![Page 11: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/11.jpg)
© All rights reserved. Zend Technologies, Inc. |
11 Geting Started with PHP on IBM i
![Page 12: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/12.jpg)
© All rights reserved. Zend Technologies, Inc.
Basic file listing script (Update) • Connect to DB2 i
• Select records from a DB2 table
• Load the records in an HTML table
02/03/10
| 12 Geting Started with PHP on IBM i
![Page 13: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/13.jpg)
© All rights reserved. Zend Technologies, Inc.
Connection to DB2 for i (Update) • Need three things:
System
User ID
Password
02/03/10
Note: If your data sets have *PUBLIC access, no user or password is required
| 13 Geting Started with PHP on IBM i
![Page 14: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/14.jpg)
© All rights reserved. Zend Technologies, Inc.
Reading data...(Update) Loop through record set
02/03/10
| 14 Geting Started with PHP on IBM i
![Page 15: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/15.jpg)
© All rights reserved. Zend Technologies, Inc.
Basic file listing script (Update)
02/03/10
| 15 Geting Started with PHP on IBM i
![Page 16: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/16.jpg)
© All rights reserved. Zend Technologies, Inc.
RPG Examples
www.zend.com
Open Source Toolkit
![Page 17: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/17.jpg)
© All rights reserved. Zend Technologies, Inc.
What is the toolkit?
•Set of classes that access IBM i native artifacts
•All Program Objects
RPG, COBOL, CL, etc.
•Others
Command processor
Data Queue’s
Spooled File
More…
•Access naturally from PHP code. No SP’s required
•Easy to use
17 Insert->Header & Footer
![Page 18: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/18.jpg)
© All rights reserved. Zend Technologies, Inc.
New toolkit is Object Oriented
•Series of classes that “wrap” the IBM project
•All PHP but Object Oriented…(wait, there’s more!)
•Zend built the PHP wrapper
•No OO training required to use them!!!
•Sam Pinkhasov, Zend
19 Insert->Header & Footer
![Page 19: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/19.jpg)
© All rights reserved. Zend Technologies, Inc.
XML Service
• IBM has open sourced XMLService.
•First Open Source project on IBM i. (that I know of…)
•Made up of RPG, CL and DB2 stored procedures (SQL)
•Tony Cairns, IBM Rochester
21 Insert->Header & Footer
![Page 20: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/20.jpg)
© All rights reserved. Zend Technologies, Inc.
XML Service
•Cross platform
•Language agnostic
•Basic plumbing for all open source languages
22 Insert->Header & Footer
![Page 21: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/21.jpg)
© All rights reserved. Zend Technologies, Inc.
Compatibility Wrapper
• Intercepts existing i5 function requests
•Written in pure PHP
•Passes them on to OO PHP which then…
•Passes on to XML Service
•Alan Seiden, SBS & alanseiden.com
23 Insert->Header & Footer
![Page 22: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/22.jpg)
© All rights reserved. Zend Technologies, Inc.
Source Code for XML Service on YiPs…
24 Insert->Header & Footer
•http://youngiprofessionals.com/
![Page 23: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/23.jpg)
© All rights reserved. Zend Technologies, Inc.
Source Code for PHP Toolkit on GitHub…
25 Insert->Header & Footer
•https://github.com/zendtech/IbmiToolkit
![Page 24: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/24.jpg)
© All rights reserved. Zend Technologies, Inc.
PHP Classes
•Class where all wrapper functions start
Yes, this is OO but not too bad…
Look at it and poke around, It’s OK!
This is why we need the path set correctly
26 Insert->Header & Footer
![Page 25: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/25.jpg)
© All rights reserved. Zend Technologies, Inc.
Housekeeping…
•Need to set the extension and instantiate the object
Singleton pattern
Try & Catch
Can put this in your own include
27 Insert->Header & Footer
![Page 26: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/26.jpg)
© All rights reserved. Zend Technologies, Inc.
Now the program call
•Set parameters based on function
Call program
Output results
28 Insert->Header & Footer
I/O
Length
Comment
Var name
Init val
![Page 27: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/27.jpg)
© All rights reserved. Zend Technologies, Inc.
AddParameterChar •Located in ToolkitService.php
/usr/local/zendsvr/share/ToolkitAPI
Uses CharParam which extends ProgramParam, etc…
29 Insert->Header & Footer
![Page 28: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/28.jpg)
© All rights reserved. Zend Technologies, Inc.
Before and after…Part 1 •Existing code call
30 Insert->Header & Footer
![Page 29: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/29.jpg)
© All rights reserved. Zend Technologies, Inc.
Before and after…Part 2 •New Open Source Toolkit program call
31 Insert->Header & Footer
![Page 30: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/30.jpg)
© All rights reserved. Zend Technologies, Inc.
Additional Parameter Types
• AddParameterInt32($io, $comment, $varName, $value, $dimension)
• AddParameterInt64($io, $comment, $varName, $value, $dimension)
• AddParameterUInt32($io, $comment, $varName, $value, $dimension)
• AddParameterUInt64($io, $comment, $varName, $value, $dimension)
• AddParameterFloat ($io, $comment, $varName, $value, $dimension)
• AddParameterReal($io, $comment, $varName, $value, $dimension)
• AddParameterPackdec($io, $length, $scale, $comment, $varName, $value, $dimension)
• AddParameterZoned($io, $length, $scale, $comment, $varName, $value, $dimension)
• AddParameterBin($io, $size, $comment, $varName, $value, $dimension)
• AddDataStruct($array, $parameters, $name=‘struct_name’, $dim, $by, $isArray, $labelLen)
32 Insert->Header & Footer
![Page 31: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/31.jpg)
© All rights reserved. Zend Technologies, Inc.
RPG Examples
www.zend.com
Stored Procedure - Array
![Page 32: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/32.jpg)
© All rights reserved. Zend Technologies, Inc.
Now an array
Data elements are nice, but…
Sometimes you need a little more…
How about an array of information?
34
![Page 33: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/33.jpg)
© All rights reserved. Zend Technologies, Inc.
Have RPG build an array and use SQL…
35 Insert->Header & Footer
![Page 34: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/34.jpg)
© All rights reserved. Zend Technologies, Inc.
SQL to create the SP & test in iNav CREATE PROCEDURE mpavlak/rpgsp2() LANGUAGE RPGLE
EXTERNAL NAME mpavlak/rpgsp2 GENERAL
36 Insert->Header & Footer
![Page 35: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/35.jpg)
© All rights reserved. Zend Technologies, Inc.
Test it in iNav…
37 Insert->Header & Footer
![Page 36: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/36.jpg)
© All rights reserved. Zend Technologies, Inc.
Now open results in PHP…
38 Insert->Header & Footer
![Page 37: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/37.jpg)
© All rights reserved. Zend Technologies, Inc.
Results in browser…
39 Insert->Header & Footer
![Page 38: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/38.jpg)
© All rights reserved. Zend Technologies, Inc.
RPG Examples
www.zend.com
Stored Procedure – Record Set
![Page 39: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/39.jpg)
© All rights reserved. Zend Technologies, Inc.
Have RPG build the result set and use SQL…
41 Insert->Header & Footer
![Page 40: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/40.jpg)
© All rights reserved. Zend Technologies, Inc.
SQL to create the SP & test in iNav CREATE PROCEDURE mpavlak/rpgsp3() LANGUAGE RPGLE
EXTERNAL NAME mpavlak/rpgsp3 GENERAL
42 Insert->Header & Footer
![Page 41: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/41.jpg)
© All rights reserved. Zend Technologies, Inc.
Now open results in PHP…
43 Insert->Header & Footer
![Page 42: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/42.jpg)
© All rights reserved. Zend Technologies, Inc.
Results in browser…
44 Insert->Header & Footer
![Page 43: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/43.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server Update
www.zend.com
Command processing & *libl
![Page 44: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/44.jpg)
© All rights reserved. Zend Technologies, Inc.
Several ways to call commands…
•$conn->CLCommand(‘my command’);
•$conn->CLInteractiveCommand(‘DSP… command’);
•$conn->CLCommandWithOutput(‘RTV… command’);
![Page 45: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/45.jpg)
© All rights reserved. Zend Technologies, Inc.
Other uses for the toolkit
•Command processing
Call CL command directly from toolkit
Retrieve response from command call
•Example
DSPLIBL
CHGLIBL
DSPLIBL
Useful for managing access to resource
• Files & Programs from RPG
47 Insert->Header & Footer
![Page 46: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/46.jpg)
© All rights reserved. Zend Technologies, Inc. 48 Insert->Header & Footer
![Page 47: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/47.jpg)
© All rights reserved. Zend Technologies, Inc.
PHP Code
49 Insert->Header & Footer
![Page 48: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/48.jpg)
© All rights reserved. Zend Technologies, Inc. 50 Insert->Header & Footer
![Page 49: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/49.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server Update
www.zend.com
Pricing Example
![Page 50: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/50.jpg)
© All rights reserved. Zend Technologies, Inc.
Standard line discount
•RPG is black box, callable from nearly anywhere
•PHP has function to contain RPG call
•Routine to spin through line call for each quantity
52 Insert->Header & Footer
![Page 51: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/51.jpg)
© All rights reserved. Zend Technologies, Inc.
Mainline of code
53 Insert->Header & Footer
![Page 52: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/52.jpg)
© All rights reserved. Zend Technologies, Inc.
CalcDiscount() Part 1
•Setup session for user-RPG program dedication
54 Insert->Header & Footer
![Page 53: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/53.jpg)
© All rights reserved. Zend Technologies, Inc.
CalcDiscount() Part 2 •Create object, etc.
55 Insert->Header & Footer
![Page 54: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/54.jpg)
© All rights reserved. Zend Technologies, Inc.
CalcDiscount() Part 3 •Call program
56 Insert->Header & Footer
![Page 55: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/55.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server Update
www.zend.com
Miscellaneous Toolkit Points
![Page 56: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/56.jpg)
© All rights reserved. Zend Technologies, Inc.
What was passed?
•Toolkit.ini setting
Debug = TRUE
•Turns on DebugOutput file
debugLogFile = "/usr/local/zendsvr/share/ToolkitApi/debug.log“
•Many other directive settings here
58 Insert->Header & Footer
![Page 57: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/57.jpg)
© All rights reserved. Zend Technologies, Inc.
Contents of output
59 Insert->Header & Footer
![Page 58: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/58.jpg)
© All rights reserved. Zend Technologies, Inc.
Stateful processing
•IPC
•Use session ID, for example • $PHPToolkitObj->setToolkitServiceParams ( array ('InternalKey' => "/tmp/$user" ) );
60 Insert->Header & Footer
![Page 59: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/59.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server Update
www.zend.com
Wrap it up
![Page 60: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/60.jpg)
© All rights reserved. Zend Technologies, Inc.
Join us at
ZendCon Advancing the World of PHP
Conference Highlights
● Sessions designed for all knowledge levels
● Intensive tutorials for accelerated learning
● UnConference sessions for expanded topics
● PHP Certification crash course and 50% discount on certification exams
● Exhibit hall showcasing the latest products
● Networking opportunities with PHP community members and thought-leaders from around the world
w w w . z e n d c o n . c o m
Conference Tracks
● PHP Best Practices & Tooling Take home the latest tips and techniques for high-quality PHP apps
● Continuous Delivery & DevOps Explore best practices for high-velocity application delivery
● Application Architecture - APIs, Mobile, Cloud Services Learn how to harness the server-side and client-side revolutions
![Page 61: PHP on IBM i RPG Examples - MRMUGmrmug.org/archives/docs/November 2014 Presentation... · PHP on IBM i RPG Examples Mike Pavlak Solution Consultant . Mike.p@zend.com ... PHP is to](https://reader031.fdocuments.net/reader031/viewer/2022022517/5b0a17fa7f8b9adc138b89ed/html5/thumbnails/61.jpg)
© All rights reserved. Zend Technologies, Inc. 63 Insert->Header & Footer
Q&A
www.zend.com
Please fill out your Session Evaluation!