step by step: rpg report to the web - php web application server
TRANSCRIPT
![Page 2: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/2.jpg)
Join us at ZendConthe premier PHP conference!
October 19-22, 2009 - San Jose California
Zend/PHP Conference
www.zendcon.com
Conference Highlights Conference Tracks� Learn how to best develop and deploy PHP � Server/Operations� Technical sessions for all knowledge levels � Lifecycle Best Practices� In‐depth tutorials for advanced learning � Frameworks � PHP Certification courses and testing � Real‐World PHP� Exhibit hall showcasing the latest products � PHP Development Techniques� Networking opportunities with peers and luminaries � Zend Solutions for PHP on IBM i
![Page 3: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/3.jpg)
Target audience
• Looking to move beyond Green Screen• Have little to no experience with PHP• Want to pick up a little about HTML and CSS• Have done about a million RPG reports...
Copyright © 2009 Zend Technologies, Inc, All rights reserved 10/5/2009 | 3
![Page 4: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/4.jpg)
Agenda
• Review of recorded webinars• Look at database & sample report• Explore the result of the web page• Step by step:
1. Connect to DB22. Build main loop3. Add references and calculations4. Add formatting5. Bells and whistles
1. RPG program Call2. Output to PDF (free and easy!)
• Wrap up / Q&ACopyright © 2009 Zend Technologies, Inc, All rights reserved 10/5/2009 | 4
![Page 5: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/5.jpg)
Review of Webinars
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved| 5
![Page 6: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/6.jpg)
Webinars for IBM i
• http://www.zend.com/en/resources/webinars/i5-os
! Getting Started with PHP for i5 shops! Web Services on i5! PHP 101 for i5 shops! Confessions from RPG developer: Why use Zend Framework?! Confessions from RPG developer: Why use Zend Framework?! How RPG Programmers can Leverage Arrays! Give Your IBM iSeries an Extreme Makeover with Zend & PHP!! Using PHP and System i to Improve Vendor Productivity! Platform for i5/OS - What i5 shops need to know! 5250 Bridge and Zend Platform! Platform for i5/OS - What i5 shops need to know
| 5-Oct-09Modernizing legacy applications on i5 with PHP | 6
![Page 7: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/7.jpg)
Look at the data base
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved| 7
![Page 8: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/8.jpg)
How is this thing going to work?
• New series offered by Zend: Step by Step! Move your RPG report to the web with PHP
• This is a very simple but manual process, no magic here• Everything to run RPG and PHP is provided• You can play all you want• No copyright on any code, use as-is-as-shown• Website will contain periodic updates
! Next: Maintain your DB2 data with PHP! After that it is up to you! What do you want to see?
| 5-Oct-09Modernizing legacy applications on i5 with PHP | 8
![Page 9: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/9.jpg)
Sample Database is provided using PHP
• Used pure PHP and SQL to create database• Run PHP script called: builddata.php• Create collection, then tables, then load tables…• You can add records as you see fit• This may even prove useful in your shop
• Let’s look at some code
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 9
![Page 10: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/10.jpg)
Create Collection - ZENDSMP010
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 10
![Page 11: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/11.jpg)
Create Table
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 11
![Page 12: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/12.jpg)
Load data in table
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 12
![Page 13: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/13.jpg)
• Now you have the sample data base, how about the sample report?
• It is a very basic Order Summary• Written in RPG Free
U i SQL d t• Using SQL data access
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 13
![Page 14: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/14.jpg)
RPG Code Sample
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 14
![Page 15: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/15.jpg)
Report Output
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 15
![Page 16: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/16.jpg)
Let’s see the new web page!
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved| 16
![Page 17: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/17.jpg)
Target solution:
•What you see:•Logo•Headings•Green bar look
•(ahhhhhhhh!)•Detail records•Data &cell formatting
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 17
•Totals
•What you don’t see•PHP Code•HTML•CSS•How we get here
•Step-by-step
![Page 18: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/18.jpg)
Here are the steps
1. Connect to DB2 (Top of the cycle)2. Build main loop (Mainline)3. Add references (Chain)4. Add formatting (Edit codes)
Database layout:
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 18
SALESORD
SALESLINE CUSTOMER
![Page 19: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/19.jpg)
Before we begin…Do your homework!
• Research the RPG program! Many details can be overlooked! What is it doing well, not so well
• Talk to primary user! Are there additional needs! Are there additional needs! Would a web version truly help them! Will they still require hard-copy
• Prepare for the onslaught! Once one user gets web based solutions, they all want them!
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 19
![Page 20: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/20.jpg)
Step 1: Connect to DB2
• Use DB2_Connect function! Why not i5_connect? Could have done
• A few words about authority! If your data sets are *PUBLIC *Read, no auth necessary! Can do authentication a couple of ways! Can do authentication a couple of ways! Or hard code userid and password
• Let’s look at the code…• The code for each step will be provided on the
website in a week or so.
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 20
![Page 21: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/21.jpg)
Connect to DB2 code
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 21
![Page 22: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/22.jpg)
Connect to DB2 Display
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 22
![Page 23: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/23.jpg)
Step 2: Build Main Loop
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 23
![Page 24: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/24.jpg)
Step 2 Output
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 24
![Page 25: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/25.jpg)
Step 3: Add references to other tables
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 25
![Page 26: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/26.jpg)
Step 3 Output
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 26
![Page 27: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/27.jpg)
Step 4a Code & Output
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 27
Standard HTML Heading
![Page 28: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/28.jpg)
Step 4b code & output
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 28
Format web page in script:Effective, but is it
smart?
![Page 29: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/29.jpg)
Step 4c Part 1
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 29
![Page 30: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/30.jpg)
PHP Toolkit Example
Access IBM i via PHP toolkit for Data Area
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 30
![Page 31: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/31.jpg)
Step 4c part 2
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 31
![Page 32: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/32.jpg)
Total time!
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 32
![Page 33: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/33.jpg)
Finished product
Completed scriptTake it home and embellishWorks on complex RPG too!
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 33
![Page 34: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/34.jpg)
Bells and whistles…
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved| 34
![Page 35: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/35.jpg)
Bells and whistles
• Consider an i5 program call• Order detail and PDF formatting
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 35
![Page 36: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/36.jpg)
i5 Program Call
• Three main ways to modernize! Rewrite! Restructure! Reface
• Put business logic where it makes sense for youPut business logic where it makes sense for you• Leverage the decades of RPG routines that work
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 36
![Page 37: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/37.jpg)
Program call prepare…
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 37
![Page 38: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/38.jpg)
Program call, Execute
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 38
![Page 39: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/39.jpg)
Order Detail Print…
• Read order detail file• Instantiate a PDF object• Update the object with the contents of the order• Write the PDF• Dispose of the object• Admire our work!
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 39
![Page 40: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/40.jpg)
Zend_PDF
• Component of Zend Framework• Comes with Zend Core for i5• FREE!!!• ZF is built by the community, for the community• Documentation at: http://framework.zend.com/manual/en/zend.pdf.html
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 40
•Tutorial•Documentation•Examples at framework.zend.com
•
![Page 41: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/41.jpg)
Read through detail
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 41
![Page 42: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/42.jpg)
Build PDF & heading
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 42
![Page 43: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/43.jpg)
Roll through the detail in the PDF
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 43
![Page 44: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/44.jpg)
PDF File in IFS
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 44
![Page 45: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/45.jpg)
PDF file
10/5/2009Copyright © 2009 Zend Technologies, Inc, All rights reserved | 45
![Page 46: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/46.jpg)
New book!
Kevin Schroeder from Zend’s Global Services Group
with Jeff Olen, co-author of…
Get yours at MCPressonlineor at fine bookstores
everywhere
| 5-Oct-09Name of this section | 46
![Page 47: Step by Step: RPG Report to the web - PHP Web Application Server](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb49d22e268c58cd5c65c5/html5/thumbnails/47.jpg)
Join us at ZendConthe premier PHP conference!
October 19-22, 2009 - San Jose California
Zend/PHP Conference
www.zendcon.com
Conference Highlights Conference Tracks� Learn how to best develop and deploy PHP � Server/Operations� Technical sessions for all knowledge levels � Lifecycle Best Practices� In‐depth tutorials for advanced learning � Frameworks � PHP Certification courses and testing � Real‐World PHP� Exhibit hall showcasing the latest products � PHP Development Techniques� Networking opportunities with peers and luminaries � Zend Solutions for PHP on IBM i