SlideShare a Scribd company logo
1 of 27
Stored Procedures with
                                 PHP on IBM i
Mike Pavlak
Solution Consultant


To watch the related webinar, please go to:

http://bit.ly/s4q0W4

                                              © All rights reserved. Zend Technologies, Inc.
Agenda

    • Updates
    • Review of Stored procedures
    • Examples
    • Q&A




2                        © All rights reserved. Zend Technologies, Inc.
Collaborative Open Source with
           PHP for IBM i
www.zend.com




 Updates




               © All rights reserved. Zend Technologies, Inc.
MySQL

    • MySQL discontinued distributions last year.
    • Zend and IBM are partnering to bring something back!
    • Get ready for…




        Zend DBi
4                         © All rights reserved. Zend Technologies, Inc.
Zend DBi

    • Zend Technologies will provide Zend DBi as a drop-in
      replacement for MySQL on the IBM i platform
    • Zend DBi will be shipped as a part of Zend Server for IBM i
      and freely downloadable as a standalone package
    • The build will remain open-source and be updated over
      time to implement relevant bug fixes and features
    • IBM will continue to maintain and deliver the DB2 Storage
      engine for MySQL for IBM i, via Zend Server and as a
      standalone package




5                          © All rights reserved. Zend Technologies, Inc.
Why Zend Dbi?

    • COMMON, COMMON Europe and WMCPA (Wisconsin Midrange
      Computer Professional Association) all use open source
      application Joomla
    • Manage their respective organizations with PHP handling
      the transactions and presentation layer.
    • These organizations depend on MySQL as the database
      storing content and important transaction processing.

               HLL(RPG,COBOL)

                   SQL
         DB2                                                  PHP
                  Storage
                                   MySQL
                  Engine

6                               © All rights reserved. Zend Technologies, Inc.
Zend Server 5.6

    • GA Toolkit
    • Application Deployment
    • PHP version 5.3.8
    • ZF version 1.11.10
    • PTF Update as well as full package distribution




7   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
New toolkit FAQ

    • New Toolkit is in Zend Server 5.1 as a beta
    • Compatibility wrapper for i5_ functions
    • GA with Zend Server 5.6




8   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
Zend Studio 9

    • Only one version of Studio
    • Check license screen to request free license
    • Per our partnership with IBM…
         1 copy of Zend Studio per user

         Must have IBM i serial number

         Includes 1 year of updates and support

         If studio was downloaded more than 1 year ago…
                 • Check out store to purchase studio
                 • See account manager for development solution



9   Insert->Header & Footer          © All rights reserved. Zend Technologies, Inc.
Collaborative Open Source with
           PHP for IBM i
www.zend.com




 Stored procedures Introduction




                © All rights reserved. Zend Technologies, Inc.
Stored Procedures…What are they?
     • Database artifacts that perform a specific task.
     • Zend Server PHP on IBM i supports access to multiple DB’s
       DB2
       MySQL
       MS SQL Server
       Oracle
       Mongo DB (Zend Server 5.6)

     • Therefore, SP’s on each are available to PHP on IBM i




11                          © All rights reserved. Zend Technologies, Inc.
Stored Procedures on IBM i…What are they?
     • Database artifacts that perform a specific task.
     • Typically written in SQL or RPG, but…
     • Can be written in nearly any HLL like
       Java, REXX, C, CL, C++, COBOL, FORTRAN, PL1




12                          © All rights reserved. Zend Technologies, Inc.
What do they look like?

     Simple SP data retrieval:
     CREATE PROCEDURE sales_price(
           IN Customer# CHAR(8),
           IN Product# CHAR(8),
           OUT price DECIMAL(12,2))
     LANGUAGE SQL
     BEGIN
      SELECT CustPrice   FROM priceTable
           WHERE CUSTNO=Customer# AND
            PRODNO=Product# AND
           active = ‘Y’
     END

13   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
New Toolkit…




14   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
Command line procedure creation …

     From PASE:
     QSH CMD(‘/usr/bin/db2 -t -f
                    /QSYS.LIB/MPAVLAK.lib/QSQLSRC.FILE/MPSQL1.MBR')


     Or…
     From Native Command Line
     RUNSQLSTM
                    SRCFILE(MPAVLAK/QSQLSRC) SRCMBR(MPSQL1)



15   Insert->Header & Footer     © All rights reserved. Zend Technologies, Inc.
Examples in New Toolkit

     • New toolkit (XML Service) is made up of
          RPG

          CL

          DB2 Stored procedures




16   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
IBM Systems Navigator…




17   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
DB2 House Keeping…
     • Supports 2 types
          External (RPG, COBOL, etc.)

          SQL

     • Implemented via C programs
     • Enhancements with each release of IBM i
          Be Careful if developing for multiple OS versions

     • SQL details:
          Supports multiple statements

          Supports iterative processing (Loop, Repeat Until, While)

          Get Diagnostics and feedback (SQLSTATE, SQLCODE)

          Can return discrete results or result sets
18   Insert->Header & Footer     © All rights reserved. Zend Technologies, Inc.
Example…




19   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
PHP code original…




20   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
Output…




21   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
PHP Code new…




22   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
New, looks like the old…




23   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
Wrap it up…

     • Advantages?
          Static objects

          Security is better (See Kevin Schroeder’s piece in SystemiNews)

          Indexing, permanent objects

          Manage queries, DBA role is emerging




24   Insert->Header & Footer    © All rights reserved. Zend Technologies, Inc.
Upcoming webcasts

     • Zend Server update Zend Server 5.6
          Moved to January 11, 2012

          Demo the new toolkit

          Application Deployment

     • Performance tuning Zend Server
     • More webcasts on the way




25   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.
Q&A

     mike.p@zend.com



26       © All rights reserved. Zend Technologies, Inc.
Webinar

     To watch the complete webinar, please go to
     • http://www.zend.com/en/resources/webinars/i5-
      os#STORPROC
     or
     • http://bit.ly/s4q0W4




27   Insert->Header & Footer   © All rights reserved. Zend Technologies, Inc.

More Related Content

More from Zend by Rogue Wave Software

More from Zend by Rogue Wave Software (20)

Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)
 
Middleware web APIs in PHP 7.x
Middleware web APIs in PHP 7.xMiddleware web APIs in PHP 7.x
Middleware web APIs in PHP 7.x
 
Ongoing management of your PHP 7 application
Ongoing management of your PHP 7 applicationOngoing management of your PHP 7 application
Ongoing management of your PHP 7 application
 
Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7
 
The Docker development template for PHP
The Docker development template for PHPThe Docker development template for PHP
The Docker development template for PHP
 
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
 
Unit testing for project managers
Unit testing for project managersUnit testing for project managers
Unit testing for project managers
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
Deploying PHP apps on the cloud
Deploying PHP apps on the cloudDeploying PHP apps on the cloud
Deploying PHP apps on the cloud
 
Data is dead. Long live data!
Data is dead. Long live data! Data is dead. Long live data!
Data is dead. Long live data!
 
Optimizing performance
Optimizing performanceOptimizing performance
Optimizing performance
 
Resolving problems & high availability
Resolving problems & high availabilityResolving problems & high availability
Resolving problems & high availability
 
Developing apps faster
Developing apps fasterDeveloping apps faster
Developing apps faster
 
Keeping up with PHP
Keeping up with PHPKeeping up with PHP
Keeping up with PHP
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
Getting started with PHP on IBM i
Getting started with PHP on IBM iGetting started with PHP on IBM i
Getting started with PHP on IBM i
 
Continuous Delivery e-book
Continuous Delivery e-bookContinuous Delivery e-book
Continuous Delivery e-book
 
Standard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend ServerStandard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend Server
 
Dev & Prod - PHP Applications in the Cloud
Dev & Prod - PHP Applications in the CloudDev & Prod - PHP Applications in the Cloud
Dev & Prod - PHP Applications in the Cloud
 
The Truth about Lambdas and Closures in PHP
The Truth about Lambdas and Closures in PHPThe Truth about Lambdas and Closures in PHP
The Truth about Lambdas and Closures in PHP
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Stored Procedures with PHP on IBM i

  • 1. Stored Procedures with PHP on IBM i Mike Pavlak Solution Consultant To watch the related webinar, please go to: http://bit.ly/s4q0W4 © All rights reserved. Zend Technologies, Inc.
  • 2. Agenda • Updates • Review of Stored procedures • Examples • Q&A 2 © All rights reserved. Zend Technologies, Inc.
  • 3. Collaborative Open Source with PHP for IBM i www.zend.com Updates © All rights reserved. Zend Technologies, Inc.
  • 4. MySQL • MySQL discontinued distributions last year. • Zend and IBM are partnering to bring something back! • Get ready for… Zend DBi 4 © All rights reserved. Zend Technologies, Inc.
  • 5. Zend DBi • Zend Technologies will provide Zend DBi as a drop-in replacement for MySQL on the IBM i platform • Zend DBi will be shipped as a part of Zend Server for IBM i and freely downloadable as a standalone package • The build will remain open-source and be updated over time to implement relevant bug fixes and features • IBM will continue to maintain and deliver the DB2 Storage engine for MySQL for IBM i, via Zend Server and as a standalone package 5 © All rights reserved. Zend Technologies, Inc.
  • 6. Why Zend Dbi? • COMMON, COMMON Europe and WMCPA (Wisconsin Midrange Computer Professional Association) all use open source application Joomla • Manage their respective organizations with PHP handling the transactions and presentation layer. • These organizations depend on MySQL as the database storing content and important transaction processing. HLL(RPG,COBOL) SQL DB2 PHP Storage MySQL Engine 6 © All rights reserved. Zend Technologies, Inc.
  • 7. Zend Server 5.6 • GA Toolkit • Application Deployment • PHP version 5.3.8 • ZF version 1.11.10 • PTF Update as well as full package distribution 7 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 8. New toolkit FAQ • New Toolkit is in Zend Server 5.1 as a beta • Compatibility wrapper for i5_ functions • GA with Zend Server 5.6 8 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 9. Zend Studio 9 • Only one version of Studio • Check license screen to request free license • Per our partnership with IBM… 1 copy of Zend Studio per user Must have IBM i serial number Includes 1 year of updates and support If studio was downloaded more than 1 year ago… • Check out store to purchase studio • See account manager for development solution 9 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 10. Collaborative Open Source with PHP for IBM i www.zend.com Stored procedures Introduction © All rights reserved. Zend Technologies, Inc.
  • 11. Stored Procedures…What are they? • Database artifacts that perform a specific task. • Zend Server PHP on IBM i supports access to multiple DB’s DB2 MySQL MS SQL Server Oracle Mongo DB (Zend Server 5.6) • Therefore, SP’s on each are available to PHP on IBM i 11 © All rights reserved. Zend Technologies, Inc.
  • 12. Stored Procedures on IBM i…What are they? • Database artifacts that perform a specific task. • Typically written in SQL or RPG, but… • Can be written in nearly any HLL like Java, REXX, C, CL, C++, COBOL, FORTRAN, PL1 12 © All rights reserved. Zend Technologies, Inc.
  • 13. What do they look like? Simple SP data retrieval: CREATE PROCEDURE sales_price( IN Customer# CHAR(8), IN Product# CHAR(8), OUT price DECIMAL(12,2)) LANGUAGE SQL BEGIN SELECT CustPrice FROM priceTable WHERE CUSTNO=Customer# AND PRODNO=Product# AND active = ‘Y’ END 13 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 14. New Toolkit… 14 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 15. Command line procedure creation … From PASE: QSH CMD(‘/usr/bin/db2 -t -f /QSYS.LIB/MPAVLAK.lib/QSQLSRC.FILE/MPSQL1.MBR') Or… From Native Command Line RUNSQLSTM SRCFILE(MPAVLAK/QSQLSRC) SRCMBR(MPSQL1) 15 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 16. Examples in New Toolkit • New toolkit (XML Service) is made up of RPG CL DB2 Stored procedures 16 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 17. IBM Systems Navigator… 17 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 18. DB2 House Keeping… • Supports 2 types External (RPG, COBOL, etc.) SQL • Implemented via C programs • Enhancements with each release of IBM i Be Careful if developing for multiple OS versions • SQL details: Supports multiple statements Supports iterative processing (Loop, Repeat Until, While) Get Diagnostics and feedback (SQLSTATE, SQLCODE) Can return discrete results or result sets 18 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 19. Example… 19 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 20. PHP code original… 20 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 21. Output… 21 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 22. PHP Code new… 22 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 23. New, looks like the old… 23 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 24. Wrap it up… • Advantages? Static objects Security is better (See Kevin Schroeder’s piece in SystemiNews) Indexing, permanent objects Manage queries, DBA role is emerging 24 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 25. Upcoming webcasts • Zend Server update Zend Server 5.6 Moved to January 11, 2012 Demo the new toolkit Application Deployment • Performance tuning Zend Server • More webcasts on the way 25 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.
  • 26. Q&A mike.p@zend.com 26 © All rights reserved. Zend Technologies, Inc.
  • 27. Webinar To watch the complete webinar, please go to • http://www.zend.com/en/resources/webinars/i5- os#STORPROC or • http://bit.ly/s4q0W4 27 Insert->Header & Footer © All rights reserved. Zend Technologies, Inc.