+ All Categories
Home > Documents > 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of...

5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of...

Date post: 21-Jul-2018
Category:
Upload: truongkhuong
View: 217 times
Download: 0 times
Share this document with a friend
21
Jon.Paris @ Partner400.com www.systemideveloper.com www.Partner400.com 5250 Bridge and Platform Exploiting RPG Applications in new ways
Transcript
Page 1: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Jon.Paris @ Partner400.com

www.systemideveloper.com

www.Partner400.com

5250 Bridge and Platform

Exploiting RPG Applications in new ways

Page 2: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Using RPG programs in new ways

The latest option - Zend 5250 Bridge

• A new approach for putting Green-screen applications to work in new ways

- For example as Web Services

- In a new "Web Faced" role

- Via Portals and Mash Ups

What is the "Bridge"

• How do you get it

• Technical Overview of components

The Bridge Demonstration Programs

• Green Screen Emulator

• Simple Web Interface

• AJAX style Web Interface

A brief example of the basic procedural APIs

• A different kind of 5250 Programming!

The Bridge is a Toolkit of possibilities

• Not a Silver Bullet "Solution"

• Where might the future take us?

Page 3: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

What is the "Bridge"

Three sets of APIs that allow a PHP script to drive a 5250 session

• Object Oriented APIs

• Procedural APIs

- During the session these are the ones we will be focusing on

Multiple 5250 sessions can be connected to a single script

• So you could combine the data from several green screen

applications in a single browser window!

Bridge is available as one of the integration features of Zend

Platform

Page 4: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Product Advantages

Doesn't require WebSphere Application Server

• So CPW requirements are lower

No 5250 workload

• Use batch for green screen programs instead of interactive

Easy to install

• No application source required – works on display file objects

No charge for one connection

• Play in the sandbox until you can convince the boss to purchase

Modernize the application

• Using AJAX and other advanced web based technologies

Page 5: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Technical Overview

Supplied as a PHP library

• Contains a set of PHP functions/classes to access 5250 data

• Includes a number of demonstration programs

Allows you to run any 5250 applications under PHP control

• Utilizes IBM's WebFacing server

• Part of i5/OS TCP/IP

All screen information available ...

• Input and Output fields and attributes plus Format names

Page 6: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

The Supplied Demo programs

Page 7: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

API 5250 Bridge

5250 Bridge - "GreenScreen" Demo

Page 8: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

5250 Bridge - "GreenScreen" Demo

This is the default appearance

Page 9: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

.

CUSTOMIZE STYLE

5250 Bridge - "GreenScreen" Demo

But add a little style(sheet) ...

Page 10: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Subfile Demonstration Program

Page 11: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Subfile Demonstration Programs

Basic "vanilla"

version uses

procedural

functions

"Fancy" version

uses Object

interface

Page 12: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

<?php

set_include_path('/usr/local/Zend/5250/API/');

//require_once('Zend_5250.php');

require_once('greenScreenController.php');

require_once('htmlGreenScreen.php');

$usr='QA1';

$pw='QA1';

$cmd="TELNET RMTSYS('10.1.1.40')";

$bridge = new Zend_5250('i5_1');

$response = $bridge->connect();

$out = $response->getOutputField(2)->getValue();

// connect to the first i5

$bridge->setInputField(0,$usr);

$bridge->setInputField(1,$pw);

$response= $bridge->submit();

I5 Server 2 SERVER

I5 Server 1 CLIENT

Telnet Connection Using 5250 Bridge API

Page 13: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Very Simple Bridge Demo Script (1)

<?php

set_include_path('/usr/local/Zend/5250/API/');

require_once('Zend/ProceduralApi.php');

// Open a connection to the Zend 5250 Bridge, for a job with id 'simple'

$bridge = zend_5250_open('simple');

$response = @zend_5250_connect($bridge);

$inpfields = zend_5250_get_input_fields($response);

$outfields = zend_5250_get_output_fields($response);

print "<table width='800'><th>id<th>row<th>column<th>length

<th>value<th>color<th>type<th>font<th>format";

foreach ($inpfields as $field) {

print "<tr align='center'><td>$field[id]</td><td>$field[row]</td>

<td>$field[column]</td><td>$field[length]</td>

<td>$field[value]</td><td>$field[color]</td>

<td>$field[type]</td><td>$field[font]</td>

<td>$field[format]</td></tr>";

}

Page 14: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Very Simple Bridge Demo Script (2)

print '<tr><td align="center" colspan="9"><h3>Output Fields</h3></td></tr>';

foreach ($outfields as $field) {

print "<tr align='center'><td>$field[id]</td><td>$field[row]</td>

<td>$field[column]</td><td>$field[length]</td>

<td>$field[value]</td><td>$field[color]</td>

<td colspan='3'>&nbsp;</td></tr>";

}

print "</table>";

print "\n\n<h3>Var_Dump of \$inpfields</h3>\n\n";

var_dump($inpfields);

print "\n\n<h3>Var_Dump of \$outfields</h3>\n\n";

var_dump($outfields);

zend_5250_disconnect($bridge);

?>

Page 15: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Display from Simple Bridge Demo

Each field on the screen is returned as an array element:

• Each element is in turn an array containing:

- Field id, Position (Row and Column), Length, Value, Color, type, etc.

Page 16: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Extract From Basic Subfile Demo

<?php

$status = zend_5250_get_output_field_value($response, 15);

if ($status == 1) {

echo "User is active<br />\n";

} elseif ($status == 2) {

echo "User is inactive<br />\n"; }

?>

Serial number: <?php echo zend_5250_get_output_field_value($response, 11); ?><br />

Application name: <?php echo zend_5250_get_output_field_value($response, 13); ?><br /><br />

Number of sign on: <?php echo zend_5250_get_output_field_value($response, 20); ?><br />

<?php

$lang = zend_5250_get_output_field_value($response, 27);

if ($lang == 'E') {

$lang = 'English';

elseif ($lang == 'F') {

$lang = 'Francais';

} else {

$lang = 'Unknown'; }

echo "Preffered language: $lang<br />\n";

?>

Page 17: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Early Lessons Learned

It is easy to get Input and Output mixed up!

• Input is what you are going to supply to the 5250 application

- I.e. What you receive as input from the browser you will send on as input

to the 5250 application

• Output is what it sent by the 5250 application to you

- You may or may not pass it on as-is to the browser user

Remember that the the 5250 application won't directly see input

• Until your script passes it on

You need to be able to identify your screen layouts in some way

• Or you will not be able to determine which screen is "talking" to you

Some simple tools to determine field Id numbers would be useful

• Until then var_dump( ) and print_r( ) are your best friends

Remember that you will have to adapt to buffer layout changes

• But level checks will protect you from harm!

Page 18: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Procedural Bridge Functions (1)

zend_5250_open()

• Starts a session for the provided job id

zend_5250_connect()

• Creates a connection to the 5250 bridge using user name, password etc.

zend_5250_is_connected()

• Returns true if bridge is already connected

zend_5250_set_input_field()

• Sets data into an input field

- I.e It does the keyboard entry!

zend_5250_submit()

• Sends request to the 5250 bridge with a key (Enter, F keys, page up, etc.)

• Call after all input field values have been set

Page 19: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Procedural Bridge Functions (2)

zend_5250_disconnect()

• Disconnects the 5250 bridge

zend_5250_set_focused_field()

• Sets the focus of the page to a specific field

zend_5250_get_focused_field()

• Returns the field currently in focus

zend_5250_get_input_fields()

and zend_5250_get_output_fields()

• Returns all input or output fields available

zend_5250_get_input_field()

and zend_5250_get_output_field()

• Returns a specific input or output field by ID

Page 20: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Procedural Bridge Functions (3)

zend_5250_get_input_fields_count()

and zend_5250_get_output_fields_count()

• Returns the count of input or output fields available

zend_5250_get_application_error()

• Returns information about an application error if one has occurred

zend_5250_get_error()

• Returns a function error if it occurred

zend_5250_get_screen_size()

• Returns the size of the screen (width x height)

zend_5250_get_color_palette()

• Returns an array containing the i5 5250 Bridge color palette

Page 21: 5250 Bridge and Platform - Zend the PHP Company · •AJAX style Web Interface ... Three sets of APIs that allow a PHP script to drive a 5250 session ... But add a little style(sheet)

Where Might The Future Take Us?

The Bridge is a "Toolkit of Possibilities"

• You can experiment with a web front end to existing applications

• Combine multiple applications into a single view

• Use a 5250 application as a web service

• Build a different kind of 5250 application

- One that was never intended to drive a green screen!

¨ It certainly simplifies session persistence issues

What about tool builders?

• Zend or other parties may use the toolkit as a foundation for new web

enablement tools

- Perhaps an Open-Source project?

• Perhaps a starting point for a new web enabled RPG


Recommended