48
Jon.Paris @ Partner400.com www.systemideveloper.com www.Partner400.com Extending RPG with PHP Exploiting RPG Applications in new ways

Modernizing i5 Applications

  • Upload
    zendcon

  • View
    3.654

  • Download
    1

Embed Size (px)

DESCRIPTION

"PHP offers many opportunities and avenues to leverage existing i5 investments. One such area to leverage is the existing i5 applications and programs. This presentation will guide you through examples utilizing PHP to both invoke RPG/COBOL/CL programs web-enable 5250 applications."

Citation preview

Page 1: Modernizing i5 Applications

Jon.Paris @ Partner400.comwww.systemideveloper.comwww.Partner400.com

Extending RPG with PHP

Exploiting RPG Applications in new ways

Page 2: Modernizing i5 Applications

Topics

Before we discuss the options ...• A quick look at what are other users doing with PHP in i land

Updating business practices with new free/low-cost tools• Everything from Help Desk software to User Documentation

Extending your RPG application set• Using PHP to do things RPG can't do

- Or at least can't do as easily- e.g. E-mail, XML processing, Creating Spreadsheets, File Uploads

• , etc. from new web applications

Refacing 5250 with the latest option - Zend 5250 Bridge • A new option for putting 5250 applications to work in new ways

- For example as Web Services- Or in a new "Web Faced" role

Page 3: Modernizing i5 Applications

What are i Users Doing ?

Consolidation:• Re-hosting PHP applications currently running on Windows or Linux

that access data in DB2• Speed up applications while reducing complexity and increasing

reliability

Modernization:• Using PHP to web-enable green screen applications.

New application development:• Create new applications with PHP

- Intranet, Extranet, Reporting, Websites, Wikis and ...

Leveraging PHP portfolio:• Run commercial or open source PHP applications on i5/OS.

Page 4: Modernizing i5 Applications

CabelBackground

• Provide services for local banks- Strategy, organisation, management and IT consulting

Requirement• Urgent need to web-enable core green screen applications • Allow customers to access information without forcing them to install

software. • Reduce number of screens & modify application flow for ease of use

Solution:• Zend Bridge +

- Customized the 5250 PHP demo page to front-end the application• Provided connections to customers via web services• Integrated web data content

Benefits• Rapidly deployment of a web solution• Leveraged green screen business logic and DB2/400 data • Extended and enhanced functionality (documents, images, etc.)• Integration with customers without affecting their systems

Page 5: Modernizing i5 Applications

Ruger

Background• Manufacturer of sporting and law enforcement firearms • i not viewed as part of future plans

Requirement• Launch an on-line auction site - yesterday!

- www.rugerauction.com

Solution• Purchased and deployed a low-cost PHP-based package• Four RPG developers with no PHP background customized and

deployed it in a month

Benefits• Implemented on time and on budget• Laid the foundation for integration of i into future plans

Page 6: Modernizing i5 Applications

Parts Depot

Background• One of the largest distributors and resellers of automotive aftermarket

parts and paints in the U.S.

Requirement• Update business partner applications ranging from price quotations to

fulfillment to the reviewing of historical data.

Solution• Three System i 520s support the business.

- Production, Development and HA

• Developed new web application with PHP integrating with backend RPG applications

Page 7: Modernizing i5 Applications

Cremer

Background• Distribute and manufacture disposable health care products in Brazil

Requirement• Improve customer sat with a streamlined call center application

- Inventory, prices, credit status, invoice details

• Reduce software costs

Solution• Developed new PHP web-based call center application which

accesses DB2 on i5/OS V5R3

Benefits• Reduction in software costs• Rapid development – even though initially no in-house PHP skills• Faster access to DB2 information

Page 8: Modernizing i5 Applications

Icon Fitness

Background• World's largest home fitness manufacturer• Brands include NordicTrack, HealthRider, Reebok, and Pro-Form

Requirement• Quickly develop fitness/nutrition web sites to meet January demand

peak- www.ifit.com and www.iconfitness.com

Solution• Developed new consumer web sites with PHP• Ties into existing WebSphere Commerce Server

Page 9: Modernizing i5 Applications

Updating with new free/low-cost tools

Bulletin Board Content Management System

Wiki

Customer Relationship ManagementHelp Desk

Portal

e-CommerceCourse Management System

Portal

Portal

Page 10: Modernizing i5 Applications

SugarCRM

www.sugarcrm.com

Page 11: Modernizing i5 Applications

MANTIS

Help Desk Software• http://mantis400.com

Uses native DB2 under i5/OS• Data usable from RPG, Query, COBOL, SQL...

Available under GNU GPL Open Source license• I.e. It is FREE FOREVER

Create/manage Internal and External Support Issues• Any web browser, any client operating system• E-mail notification as Issues are progressed

Supported by Curbstone Corporation• They have used it in-house to track problems for a number of years

Page 12: Modernizing i5 Applications

Wikis - PMWiki

QuickTime™ and a decompressor

are needed to see this picture.

QuickTime™ and a decompressor

are needed to see this picture.

(:table width=800 align=center:)(:cell:)http://localhost:8888/pmwiki/images/Partner400Logo31.jpg(:cellnr:)!!Welcome to Partner400's Sample Documentation Web Site(:cellnr:)Yes the D-word - "Documentation".

Here you will find links to a number of web pages that will link you to articles that we have written, sample programs, and a few other bits and pieces such as travel guides and information for conference planners.

*Click here for [[Articles | a list of articles that we have written]]

*Here for [[Samples | Sample programs]]

*And here [[Other | for all the other stuff]](:tableend:)

(:table width=800 align=center:)(:cell:)http://localhost:8888/pmwiki/images/Partner400Logo31.jpg(:cellnr:)!!Welcome to Partner400's Sample Documentation Web Site(:cellnr:)Yes the D-word - "Documentation".

Here you will find links to a number of web pages that will link you to articles that we have written, sample programs, and a few other bits and pieces such as travel guides and information for conference planners.

*Click here for [[Articles | a list of articles that we have written]]

*Here for [[Samples | Sample programs]]

*And here [[Other | for all the other stuff]](:tableend:)

Page 13: Modernizing i5 Applications

Extending your RPG application set

In areas where RPG native support is weak or non-existent• e.g. XML, E-mail, Sockets, CGI

- All of these can be done via native support (XML)

- Or open source or third-party tool kits

- But can be complex to use¨ And for some people the lack of formal support is an inhibitor

By providing new interfaces to native functions• I5 Toolkit and DB2 support provide comprehensive access• Integrate system functionality into:

- Web services- New browser applications

Page 14: Modernizing i5 Applications

Comparing XML Processing in RPG and PHP

At first glance both programs look very similar• But all is not quite as it seems

<?php$Customers = simplexml_load_file("\\Partner400\\Cus tomers.xml");�

�foreach ($Customers->Customer as $customer) {� print "$customer->Company<br>";�} �?>

<?php$Customers = simplexml_load_file("\\Partner400\\Cus tomers.xml");�

�foreach ($Customers->Customer as $customer) {� print "$customer->Company<br>";�} �?>

�/Free� XML-INTO company %XML( XML_Input1: 'doc=file case =any' ); �

� for i = 1 to xmlElements;� dsply company(i); � endfor;

�/Free� XML-INTO company %XML( XML_Input1: 'doc=file case =any' ); �

� for i = 1 to xmlElements;� dsply company(i); � endfor;

Page 15: Modernizing i5 Applications

The "Missing" Part of the Comparison

The previous chart left out this part of the RPG version• RPG requires the data to be predefined• PHP does for you dynamically

D progStatus SDS � D xmlElements 20i 0 Overlay(prog Status: 372) � � D i s 10i 0 � � D customers DS Qualified� D recordCount 3p 0 � D customer LikeDS(custo mer) Dim(99)� � D customer DS Qualified� D type 10a� D company 32a� D address LikeDS(addre ss)� � D address DS� D street 32a� D city 24a� D state 2a� D zip 5s 0 �

� D XML_Input1 256a Inz('/Partne r400/Customers.xml')

D progStatus SDS � D xmlElements 20i 0 Overlay(prog Status: 372) � � D i s 10i 0 � � D customers DS Qualified� D recordCount 3p 0 � D customer LikeDS(custo mer) Dim(99)� � D customer DS Qualified� D type 10a� D company 32a� D address LikeDS(addre ss)� � D address DS� D street 32a� D city 24a� D state 2a� D zip 5s 0 �

� D XML_Input1 256a Inz('/Partne r400/Customers.xml')

Page 16: Modernizing i5 Applications

Easy Extensions - Web Services

This example uses two web services• �One to obtain the price of a stock in US$• �The other to obtain the current US$ -> Cdn$ exchange rate

�All you need to know is the name of the method• �All the underlying work is done for you

<?php�

�$QuoteClient = new SoapClient(� "http://services.xmethods.net/soap/urn:xmethods-d elayedquotes.wsdl");�$CurrencyClient = new SoapClient(� "http://www.xmethods.net/sd/2001/CurrencyExchange Service.wsdl");�

�$IBM_Price = $QuoteClient->getQuote("ibm");�$US_Cdn_Rate = $CurrencyClient->getRate("usa", "can ada");� �print("IBM stock price is \$$IBM_Price - that is \$" � . ($IBM_Price * $US_Cdn_Rate) . " in Cdn\$");�?>

<?php�

�$QuoteClient = new SoapClient(� "http://services.xmethods.net/soap/urn:xmethods-d elayedquotes.wsdl");�$CurrencyClient = new SoapClient(� "http://www.xmethods.net/sd/2001/CurrencyExchange Service.wsdl");�

�$IBM_Price = $QuoteClient->getQuote("ibm");�$US_Cdn_Rate = $CurrencyClient->getRate("usa", "can ada");� �print("IBM stock price is \$$IBM_Price - that is \$" � . ($IBM_Price * $US_Cdn_Rate) . " in Cdn\$");�?>

Page 17: Modernizing i5 Applications

Easy Extensions - Web Services

This example uses one of the Google web services• The spelling suggestion

The Google related logic is all on this page• The next page simply shows the input form

<?php if (isset($_POST['submit'])) {

$input = $_POST['input']; $signature = "oJ+6HjxQFHKudrUwGI99RrEjLmQ5jrv1";

$google = new SoapClient("GoogleSearch.wsdl"); $response = $google->doSpellingSuggestion($signatur e, $input); If (!$response) $response = "Google hasn't a clue w hat you mean!";

} else { // This is just a form request so set field defaults $input = ''; $response = '';

} ?>

<?php if (isset($_POST['submit'])) {

$input = $_POST['input']; $signature = "oJ+6HjxQFHKudrUwGI99RrEjLmQ5jrv1";

$google = new SoapClient("GoogleSearch.wsdl"); $response = $google->doSpellingSuggestion($signatur e, $input); If (!$response) $response = "Google hasn't a clue w hat you mean!";

} else { // This is just a form request so set field defaults $input = ''; $response = '';

} ?>

Page 18: Modernizing i5 Applications

<html> <head> Google Spelling API Test Page! <br><br> Enter your test string and press Submit to see what Google thinks of it<br><br> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"> Input String: <input type="text" name="input" value ="<?php echo $input ?>" /> <br> <br><br>Google responds <b><?php echo $response;?>< /b > <br><br> <input type="submit" name="submit" value="submit" / > </form> </head>

<html> <head> Google Spelling API Test Page! <br><br> Enter your test string and press Submit to see what Google thinks of it<br><br> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" m ethod="post"> Input String: <input type="text" name="input" value ="<?php echo $input ?>" /> <br> <br><br>Google responds <b><?php echo $response;?>< /b> <br><br> <input type="submit" name="submit" value="submit" / > </form> </head>

Easy Extensions - Google (contd)

It is possible to do this in RPG using Scott Klement's HTTPAPI• Or one of the other libraries

But the amount of code required is substantially greater

Page 19: Modernizing i5 Applications

Business Application Framework

ATK has an interesting approach to Frameworks• It focuses on business applications www.atk-framework.com

There is now an i5 specific version (i.e. DB2 enabled)• But the web site is only in Dutch at present (www.i7.nl)

Ivo Jansch is presenting on the topic on Thursday• "PHP in the Enterprise"

Page 20: Modernizing i5 Applications

ATK Demo/Teaching Application

Page 21: Modernizing i5 Applications

Connection ManagementConnect, change user, close….

DB2 UDB access via SQL and Record level I/OFetch as array, get field lengths, field type, ...

Create records, update, set ranges, ...

Command, Program and Procedure callsSupports return values

Data Areas, Data Queues, Message QueuesCreate, read, write, delete...

System valuesIncluding date, time, …

Spool Queues and filesList, Read, ...

i5/OS Extensions and Toolkit

Many examples available in the

manuals, forums, and other on-line sources

Many examples available in the

manuals, forums, and other on-line sources

Page 22: Modernizing i5 Applications

i5 Specific Functions - V1.5Connection Management

• �i5_connect **• �i5_close• �i5_adopt_authority• �i5_error• �i5_errormsg

�CL calls• �i5_command• �i5_cmdget

�Program Calls• �i5_program_prepare• �i5_program_call• �i5_program_close

** Latest release adds permanent connections via i5_pconnect and the corresponding i5_pclose

Significantly better performance BUT ...�

Data retrieval• i5_fetch_array

• i5_fetch_assoc • i5_fetch_object

• i5_fetch_row

• i5_info• i5_field_len

• i5_field_name

• i5_field_scale• i5_field_type

• i5_list_fields

• i5_num_fields• i5_result

Page 23: Modernizing i5 Applications

i5 Specific Functions - V1.5Native file access

• �i5_open• �i5_addnew• �I5_edit• �I5_delete• �i5_cancel_edit• �i5_setvalue• �i5_update• �i5_range_from• �i5_range_to• �i5_range_clear• �i5_data_seek• �i5_seek• �i5_bookmark

Native file access (contd.)• �i5_free_file• �i5_new_record• �i5_delete_record• �i5_update_record• �i5_get_keys

�System Values• �i5_get_system_value

�Data Areas• �i5_data_area_create• �i5_data_area_read• �i5_data_area_write• �i5_data_area_delete

Page 24: Modernizing i5 Applications

i5 Specific Functions - V1.5Data Queues

• �i5_dtaq_open• �i5_dtaq_put• �i5_dtaq_read• �i5_dtaq_close

�Jobs • �i5_jobs_joblog• �i5_jobs_joblog_close• �i5_jobs_list_start• �i5_jobs_list_close

�Message Queues • �i5_messageq_open• �i5_messageq_close

Output Queues • �i5_outq_open• �i5_outq_read• �i5_outq_close

�Spool File • �i5_spool_open• �i5_spool_get_data• �i5_spool_from_data• �i5_spool_from_file• �i5_spool_close

�User Space • �i5_userspace_create• �i5_userspace_get• �i5_userspace_delete

Page 25: Modernizing i5 Applications

Using Native Record Level I/O

Dynamically accessing fields just cannot be done in RPG

// Get input data$dbfile = $_POST['tbl'];$dblib = $_POST['lib'];

if ($dbfile == '') $dbfile = "JONSDEMOS";if ($dblib == '') $dblib = "CUSTOMERS";

$conn = i5_connect("localhost", "PARTNER400", "PASSWORD ");

// Open the file$file = i5_open("$dblib/$dbfile", I5_OPEN_READ | I5_OPEN _SHRRD);if (!$file)

die("Error while attempting to open file mode=READ $i5_error()");

// Print header row using field names$fields = i5_list_fields($file);// returns an arrayprint "<table border=1 cellpadding=3><tr bgcolor=#CC CCCC>";

// Parse the arrayforeach ($fields as $value){ print "<th>$value</th>";}

// Get input data$dbfile = $_POST[ 'tbl' ];$dblib = $_POST[ 'lib' ];

if ( $dbfile == '' ) $dbfile = "JONSDEMOS";if ( $dblib == '' ) $dblib = "CUSTOMERS";

$conn = i5_connect( "localhost" , "PARTNER400", "PASSWORD");

// Open the file$file = i5_open( " $dblib / $dbfile " , I5_OPEN_READ | I5_OPEN_SHRRD);if (! $file )

die ( "Error while attempting to open file mode=READ $i5_error ()" );

// Print header row using field names$fields = i5_list_fields( $file ); // returns an arrayprint "<table border=1 cellpadding=3><tr bgcolor=#CCCCCC> " ;

// Parse the arrayforeach ( $fields as $value ){ print "<th> $value </th>" ;}

Page 26: Modernizing i5 Applications

Using Native Record Level I/O (cont.)

This works beautifully and doesn't annoy the SQL phobic!

// Print records$rec = i5_fetch_row($file, I5_READ_FIRST); // get array

while ($rec) // while there is a record...{?><!-- Print each record --><tr><td><?php echo $rec[0]; ?></td><td><?php echo $rec[1]; ?></td><td><?php echo $rec[2]; ?></td><td><?php echo $rec[3]; ?></td><td><?php echo $rec[4]; ?></td><td><?php echo $rec[5]; ?></td></tr><?php$rec = i5_fetch_row($file, I5_READ_NEXT);} // loopprint "</table>";// finish off the table?>

// Print records$rec = i5_fetch_row( $file , I5_READ_FIRST); // get array

while ( $rec ) // while there is a record...{?><!-- Print each record --><tr ><td ><?php echo $rec [ 0]; ?></ td ><td ><?php echo $rec [ 1]; ?></ td><td ><?php echo $rec [ 2]; ?></ td ><td ><?php echo $rec [ 3]; ?></ td ><td ><?php echo $rec [ 4]; ?></ td ><td ><?php echo $rec [ 5]; ?></ td ></ tr ><?php$rec = i5_fetch_row( $file , I5_READ_NEXT);} // loopprint "</table>" ; // finish off the table?>

Page 27: Modernizing i5 Applications

i5 Function Sample - WRKSPLF

Originally released via the i5 Zend Core forum• Find it by Googling with "php wrksplf site:zend.com"

Simple simulation of WRKSPLF built with i5 APIs• Adds the ability to email or convert to PDF a spool file entry

The basic process it uses is:• i5_connect( ) to connect• i5_spool_list( ) to build list of spool files for the requested user• i5_spool_list_read( ) to read the entries in the spool queue• i5_spool_list_close( ) to close the spool link• i5_close( ) to close the connection

If a spool file is selected for display:• i5_spool_get_data( ) retrieves the spool records

Page 28: Modernizing i5 Applications

PHP WRKSPLF Output

Page 29: Modernizing i5 Applications

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 30: Modernizing i5 Applications

What is the "Bridge"

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

- Object Oriented

- Procedural - 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!• You could also include data from another system's 5250 application

by using a Telnet connection

Bridge is available as part of Zend Platform• Or as a "sandbox" single session version in a unlicensed version of

Platform (i.e. One for which the trial period has expired)

Page 31: Modernizing i5 Applications

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

Telnet enabled• Can be used to telnet to other systems and blend results into a single

interface

Page 32: Modernizing i5 Applications

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 data available ...• Input and Output fields, positions and attributes

Page 33: Modernizing i5 Applications

The Supplied Demo programs

Page 34: Modernizing i5 Applications

5250 Bridge - "GreenScreen" Demo

This is the default appearance

inputField 0

"Green Screen" demo now uses

hover help to show number and type of

field

"Green Screen" demo now uses

hover help to show number and type of

field

Page 35: Modernizing i5 Applications

.

CUSTOMIZE STYLE

5250 Bridge - "GreenScreen" Demo

But add a little style(sheet) ...

Page 36: Modernizing i5 Applications

Subfile Demonstration Program

Page 37: Modernizing i5 Applications

Subfile Demonstration Programs

Basic "vanilla" version uses

procedural functions

Basic "vanilla" version uses

procedural functions

"Fancy" version uses Object interface

"Fancy" version uses Object interface

Page 38: Modernizing i5 Applications

Very Simple Bridge Demo Script (1)<?phpset_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>";

}

Can be used as a standard "What's on the screen?" routine to be

plugged in where needed during development

Can be used as a standard "What's on the screen?" routine to be

plugged in where needed during development

Page 39: Modernizing i5 Applications

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 40: Modernizing i5 Applications

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 41: Modernizing i5 Applications

Extract From Zend's 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_fie ld_value($response, 13); ?>

<br /><br />

Number of sign on: <?php echo zend_5250_get_output_fi eld_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";

?>

Convert single character response to

full text

Convert single character response to

full text

Page 42: Modernizing i5 Applications

Early Lessons Learned

Input and Output seem backwards • "Input" is the data you send to the 5250 application

- What you receive as input from the browser you will send on as input to the 5250 application

• "Output" is what you receive from the 5250 application- You may or may not pass it on as-is to the browser user

Remember that the 5250 application won't directly see the input• Your script must pass it on

You need to be able to identify screen layouts in some way• Or you won't have a clue which screen is "talking" to you• The data from the bridge API does not include any format information

- You get the whole screen content - regardless of which format originated it

Page 43: Modernizing i5 Applications

Early Lessons Learned (contd.)

Additional tools to determine field Id numbers are needed• Latest modification to Zend's 5250 demo screen is helpful• I am looking at the possibility of using a DSPFFD Outfile

- Build a database associated with each screen that uses row/column coordinates to associates field names and the sequence identifier

¨ Subfiles and overlapping fields are a nuisance

- Result could be queried to map data to field name in script

- Using Outfile because corresponding API is really ugly

• Until there are more tools var_dump( ) and print_r( ) are your friends

Large scale projects are not for the faint hearted• If we learnt nothing else from the early days of WebFacing ...

Remember that you will have to adapt to buffer layout changes• But level checks should protect you from harm!

Page 44: Modernizing i5 Applications

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 45: Modernizing i5 Applications

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 46: Modernizing i5 Applications

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 47: Modernizing i5 Applications

Where Might The Future Take Us?

Think of Bridge is a "Toolkit of Possibilities"• You could experiment with a web front end to an existing application• Combine multiple applications into a single view

- Or subset the functionality of an application as in the subfile demo

• Use a portion of 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 and 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

Page 48: Modernizing i5 Applications

Questions - Thoughts - Lunch ?

?

There will be tables at lunch for "i" folks to meet and greet each other and the "i" Zend

team members