PHP Front End 101

(click to open)

Quick Page Table of Contents

Scanning…

PHP Front End

This example starts with a RPG based 5250 DVD search program and brings it to the web by mix/match of various PHP components. The 5250 RPG program has been factor into Model, View, Control (MVC) components to demonstrate good modern RPG coding practice that allows for easy switching of any component, but none of the example code is Object Oriented.

Tutorials

5250 RPG 101

A 5250 tutorial for PHP programmers looking to understand basic RPG and display file programming. The example is a simple 5250 DVD search program that uses a subfile to display the result list of DVDs. There is a main program (*PGM) that controls the display file (view/control), and a *SRVPGM that handles all the RPG native file i/o to the database (model).

  • What does a 5250 display file look like?
  • How do you use a subfile in a display?
  • What does modern RPG syntax look like (/free /end-free)?
  • What do RPG data specifications look like?
  • What do RPG prototype includes look like?
  • What is the RPG cycle (main loop)?
  • How do you write/read 5250 display with exfmt?
  • How do you declare RPG native I/O files?
  • How do you use long name PHP/Java files with RPG?
  • How do you open native db2 files in RPG?
  • How do you write/read with RPG native I/O?

i5 call RPG 101

Using the i5 toolkit to front-end a RPG 5250 style program back-end. We will replace the 5250 display file with a PHP front-end calling the same *SRVPGM back-end.

  • How does HTML and DSPF compare?
  • When to use HTML form METHOD=‘GET’ or METHOD=‘POST’?
  • How to make reusable PHP/HTML components?
  • What are PHP super globals ($_REQUEST, $_POST, etc.)?
  • How to avoid unset PHP array variables in $_POST?
  • How do I set the libl?
  • How do I call my *SRVPGM from PHP?

ibm_db2 101

Using the same front-end PHP view/control code with a PHP ibm_db2 model. In this case we replace the RPG *SRVPGM element with a ibm_db2 PHP script.

  • Why does ibm_db2 and i5_toolkit have different connects?
  • Why use db2_pconnect (over db2_connect)?
  • Why do browser clicks of db2_pconnect route to different Apache jobs?
  • How do I set the libl?
  • How do I call commands from ibm_db2 (set libl old way)?
  • Why is there many QSQ jobs with db2_pconnects?
  • Why is db2_connect(“*LOCAL”,”userid”,”pwd”) so slow (non-persistent)?
  • Should I use db2_connect(“*LOCAL”,”uid”,”pwd”) or db2_pconnect(“”,”“,”“)?
  • Why use db2_prepare and db2_execute?
  • Which db2_fetch API choice should I use?
  • Why is db2_fetch_row / db2_result not generally recommended?
  • What ibm_db2 APIs should I use sparingly?