You are on page 1of 111

Trevor Perry – Chief Architect. Angus Thinks!

March 2014

"What Can i do?”


An IBM i Developer’s Introduction
to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Abstract

§ Many IBM i developers have not stepped out of their PDM comfort zone.
They may code well in RPGIV, use ILE correctly, and build amazing
applications. IBM, however, have moved on, delivering modern integrated
development tools, enhancements to our core languages, and much more
capability in our IBM i operating system and database. The IBM i
community is beginning to take advantage of all these new capabilities,
although it requires research and learning.
§ While there is no quick fix to get us all up to speed, this session is
intended to touch on a wide swath of relevant topics while increasing the
confidence level of the IBM i developer. If you are wondering where to
start, this event will show you how. It covers a range of available tools,
languages, technologies, and more, that are available on IBM i. Attendees
will learn how to access the resources needed to get started with each.

2
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

You and i – Steve Will

§ http://ibmsystemsmag.blogs.com/you_and_i/

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Announcing IBM i 7.1 TR7 - 10/08/2013

§ It’s announce day again, so it’s time for a blog about the
latest capabilities we’re announcing related to IBM i.
§ Once again, there are a number of different areas being
enhanced.
§ I can’t even touch on all of them, but here are highlights in
four key areas.
– DB2
– Ruby
– ARE
– RPG

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Announcing IBM i 7.1 TR7 - 10/08/2013

§ It’s announce day again, so it’s time for a blog about the
latest capabilities we’re announcing related to IBM i.
§ Once again, there are a number of different areas being
enhanced.
§ I can’t even touch on all of them, but here are highlights in
four key areas.
– DB2
– Ruby
– ARE – Application Runtime Expert
– RPG

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Wait! What?

Ruby
§ Those of you who have been interested in having IBM i adopt
the Ruby programming language more closely will be
interested to hear about PowerRuby (Check out Tim Rowe’s
blog.)

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Modern-i-zation
§ http://iprodeveloper.com/blog/modern-i-zation

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

IBM i 7.1 Technology Refresh 7


Highlights: Application Development
§ For information about the other new features included in TR7,
please look at the IBM i zone in developerWorks.
§ Now, on to the good stuff!
– Free-Form RPG
– Java
– Ruby

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Wait! What?

Free-Form RPG
§ The most exciting new feature in TR7 for the application
development crowd is a major change to the RPG language.
In previous releases, we've been focused on making RPG "a
modern business language.”
§ This statement has been a driving force behind many of the
new updates and advancements we've made to RPG.
§ But inTR7, we've taken this to a whole new level.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Can we come back to that?

§ I want to hear more about Ruby!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Can we come back to that?

§ I want to hear more about Ruby!

§ Er… what is Ruby?


§ Why would I want Ruby?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Can we come back to that?

§ I want to hear more about Ruby!

§ Er… what is Ruby?


§ Why would I want Ruby?

§ Can we get back to Free Form RPG?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Can we come back to that?

§ I want to hear more about Ruby!

§ Er… what is Ruby?


§ Why would I want Ruby?

§ Can we get back to Free Form RPG?

§ NO!
§ Ruby!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

IBM i 7.1 TR7 Highlights

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

§ Nope, I didn't mistype that:


§ We're delivering Ruby and Rails specifically for IBM i.
§ We've partnered with a group called PowerRuby to deliver
this exciting new development ecosystem on IBM i.
§ We've been working to get all the Ruby and Rails support
compiled so that it can be quickly and easily delivered on
IBM i.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

§ In addition, we've written an IBM i DB2 "gem" that gives you
native IBM i database access from Ruby leveraging the
normal Ruby methodologies.
§ We've also been updating the XML service support to ensure
that it works when you're accessing your native IBM i artifacts
(programs, data areas, data queues, system values, and
many more).
§ The Ruby and Rails support will be available for Beta by the
end of October.
§ Follow the PowerRuby.com home page for details…
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Rails

§ Rails is a web application development framework written in


the Ruby language.
Rails focuses on the concepts of Convention over
Configuration (CoC) and Don’t Repeat Yourself (DRY)—
making programming web applications easier by making
assumptions about what every developer needs to get started
and writing less code while accomplishing more than many
other languages and frameworks.
§ Experienced Rails developers also report that it makes web
application development more fun.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Ruby (programming language)

§ Not to be confused with Ruby on Rails.


§ OS: Cross-platform
§ Website: www.ruby-lang.org
§ Ruby is a dynamic, reflective, object-oriented, general-
purpose programming language. It was designed and
developed in the mid-1990s by Yukihiro "Matz" Matsumoto in
Japan.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

High Productivity and


Reduced Development Time
§ At the feature level, Ruby on Rails doesn't offer anything new.
Existing web application frameworks have done it all before.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

High Productivity and


Reduced Development Time
§ At the feature level, Ruby on Rails doesn't offer anything new.
Existing web application frameworks have done it all before.

§ What's the big deal, then?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

High Productivity and


Reduced Development Time
§ At the feature level, Ruby on Rails doesn't offer anything new.
Existing web application frameworks have done it all before.

§ What's the big deal, then?


§ The difference lies in how Ruby on Rails does it.
§ When you can finish simple web apps in days instead of
weeks and more complicated web apps in weeks instead of
months, people notice!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

James Duncan Davidson 2005

§ “Rails is the most well thought-out web development


framework I've ever used. And that's in a decade of doing
web applications for a living. I've built my own frameworks,
helped develop the Servlet API, and have created more than
a few web servers from scratch. Nobody has done it like this
before. That's not to say they got it all right. It's by no means
"perfect". I've got more than a few nits and picks about how
things are put together. But "perfect" isn't the point. The point
is that it gets you up and going fast and has plenty of depth to
keep you going. And Rails does that very well.”

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Who uses Ruby on Rails?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Resources

§ http://www.powerruby.com

§ http://rubyonrails.org
§ https://www.ruby-lang.org

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Ruby in twenty minutes


§ https://www.ruby-lang.org/en/documentation/quickstart/

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Ruby – in summary

§ Open source development framework


– “A dynamic, open source programming language with a focus on
simplicity and productivity. It has an elegant syntax that is natural to
read and easy to write.”
§ High development productivity
§ Strong community
– Resources growing

§ Now:
– running on IBM i
– connected to IBM i DB2

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Can we get back to Free Form RPG?

dcl-ds employeeDS;
firstName char(16) Inz('James');
lastname char(30) Inz('Joyce');
salary packed(7:2) Inz(12500);
end-ds;

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

iSight – Alison Butterill

§ http://ibmsystemsmag.blogs.com/isight

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

RPG and DB2 for i Headline IBM i 7.1


TR7 Announcement
§ IBM i 7.1 TR7 includes some major updates to the RPG
language.
§ There is a new syntax that allows programmers to do away
with the fixed, columnar format, making the code easier to
read and certainly easier to learn.
§ For many years, IBM has heard from our advisory councils,
clients and partners that RPG programmers are hard to find.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

RPG and DB2 for i Headline IBM i 7.1


TR7 Announcement
§ Three key ingredients
– Making the syntax easier.
– Provide education about the new language.
•  RPG is just another language that is easy to learn
– Arcad’s Transform RPG product
•  Move existing traditional-style RPG code into the new free form syntax

§ Landing page for Refresh Updates:


– http://www.ibm.com/developerworks/ibmi/techupdates

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

iDevelop – Jon Paris and Susan Gantner

§ http://ibmsystemsmag.blogs.com/idevelop

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

iDevelop – totally free

§ http://ibmsystemsmag.blogs.com/idevelop/2013/10/as-you-
may-have-already-heard-there-was-a-major-technology-
refresh-tr-announcement-yesterday-check-out-fellow-blogger-
st.html

§ We'll be writing more about this new totally free RPG in


EXTRA this month. We'll post a link to it in the comments
when it's available. Until then, what do you think?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

iDevelop – Free Format RPG program


ctl-opt option(*srcstmt) dftactgrp(*No);
dcl-ds employeeDS;
firstName char(16) Inz('James');
lastname char(30) Inz('Joyce');
salary packed(7:2) Inz(12500);
end-ds;
// Define printer file and associated DS
dcl-f qprint printer(80);
dcl-ds prtDs len(80) end-ds;
// Also write out details to the printer file
prtDs = 'The name of our new employee is ' +
%TrimR(firstName) + ' ' + %TrimR(lastName) +
' his salary is $' + %Char(salary);
write qprint prtds;
*InLR = *On;

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Other Resources

§ RPG Café blog


– https://www.ibm.com/developerworks/community/blogs/
b542d3ac-0785-4b6f-8e53-f72051460822/

§ IBM i 7.1
Programming
IBM Rational Development Studio for i
ILE RPG Reference
– http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/books/
sc092508a.pdf

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Can I take IBM i to the Web?

§ IBM software
§ Third party tools

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

IBM i to the web - IBM Software

§ IBM i Access for web


§ Integrated Web Application Server for IBM i
§ Integrated Web Services for IBM i
§ Navigator for i

§ IBM DB2 Web Query


§ Rational Host Access Transformation Services (HATS)
– Refacing
– Web services

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

IBM i Access for web

§ Is system based; there is no code running on the desktop.


§ Is implemented using Java Servlet technology.
§ Uses industry standard protocols - HTTP, HTTPS and HTML.
§ Is lightweight, requiring only a browser on the client.
§ Runs batch commands, provides access to database,
integrated file system, printers, printer output, and messages,
and a 5250 interface.

§ IBM web site


– http://www-03.ibm.com/systems/power/software/i/access/web.html

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Wait! What?

§ Runs batch commands


§ Provides access to
– Database
– Integrated file system
– Printers
– Printer output
– Messages
– A 5250 interface

§ Documentation
– http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rzamm/rzamm.pdf

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

IBM i Access for web

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

§ IBM Navigator for i is the integrated, web-based console that


consolidates IBM i systems management tasks in one place.
§ Available on IBM i systems since V6R1, IBM Navigator for I
is considerably enhanced in v7.1.
§ It continues to be the strategic tool for IBM i management.
§ It also works in concert with IBM Systems Director to enable
heterogeneous, cross-system management.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

§ Accessing it is as easy as pointing your web browser at:


http://{system}:2001
§ The IBM Systems Director Navigator for i console allows you
to easily manage an IBM i partition without having to
purchase or install anything.
§ Everything is included in the IBM i 7.1 operating system.
§ Just ensure the HTTP Admin Server is running on your
system (STRTCPSVR SERVER(*HTTP)
HTTPSVR(*ADMIN)), enter the above URL, and away you
go!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

IBM i to the web – third party tools

§ Vendor modernization space is crowded


– Sort through the vendor noise
– Find a vendor that suits your skill set

§ Zend PHP

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

PHP

§ PHP is a server-side scripting language designed for web


development but also used as a general-purpose
programming language.
§ PHP code is interpreted by a web server with a PHP
processor module, which generates the resulting web page

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Zend Server for IBM i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Zend Server for IBM i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Zend Server for IBM i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

PHP code

<!DOCTYPE html>
<meta charset="utf-8">
<title>PHP Test</title>
<?php
echo 'Hello World';
?>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Wait! What?

<!DOCTYPE html>
<meta charset="utf-8">
<title>PHP Test</title>
<?php
echo 'Hello World';
?>

§ Isn’t that HTML?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML, CSS, Javascript

§ All browser applications


§ Language of the web

§ HTML
– Markup Language
§ CSS
– Style Sheets
§ Javascript
– Client side scripting

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML

<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML

<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML

<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML

<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

CSS

body {
background-color:#d0e4fe;
}
h1 {
color:orange;
text-align:center;
}
p {
font-family:"Times New Roman";
font-size:20px;
}

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

CSS

body {
background-color:#d0e4fe;
}
h1 {
color:orange;
text-align:center;
}
p {
font-family:"Times New Roman";
font-size:20px;
}

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Javascript
<!DOCTYPE html>
<html>
<body>
<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>
<button type="button" onclick="displayDate()">
Display Date
</button>
</body>
</html>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Javascript
<!DOCTYPE html>
<html>
<head>
<script>
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>
...
</body>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML DOM Tree

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML DOM Tree

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Now, back to PHP

<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

PHP writes HTML

<?php
$txt1="Learn PHP";
$txt2="W3Schools.com";
$cars=array("Volvo","BMW","Toyota");

echo $txt1;
echo "<br>";
echo "Study PHP at $txt2";
echo "My car is a {$cars[0]}";
?>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

HTML Table
<?php
$rows = 10; // define number of rows
$cols = 4;// define number of columns
echo "<table border='1'>";
for($tr=1;$tr<=$rows;$tr++){
echo "<tr>";
for($td=1;$td<=$cols;$td++){
echo "<td>row: ".$tr." column: ".$td."</td>";
}
echo "</tr>";
}
echo "</table>";
?>
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

Wait! What?
§ PHP
for($td=1;$td<=$cols;$td++){
echo "<td>row: ".$tr." column: ".$td."</td>";
}

§ Javascript
for(td=1;td<=cols;td++){
document.write("<td>row: "+tr+" column: "+td+"</td>”);
}

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Wait! What?
§ PHP
for($td=1;$td<=$cols;$td++){
echo "<td>row: ".$tr." column: ".$td."</td>";
}

§ RPG
td = 1;
DOW td < cols;
htmlfield = "<td>row: “+tr+" column: ”+td+"</td>”;
write outfmt;
count += 1;
ENDDO;

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

That’s better!
§ PHP
for($td=1;$td<=$cols;$td++){
echo "<td>row: ".$tr." column: ".$td."</td>";
}

§ RPG
FOR td = 1 by 1 to cols;
htmlfield = "<td>row: “+tr+" column: ”+td+"</td>”;
write outfmt;
ENDFOR;

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

But it all looks the same!

§ Scripting languages are similar


– Syntax is similar
– Different enough to be confusing
– Comes with practice

§ Where does it run?


– PHP: Server side
– Javascript: Client side

§ Use the right editor

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Taking RPG to the web

§ Common Gateway Interface (CGI)

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Taking RPG to the web

§ Common Gateway Interface (CGI)


§ Is a standard method used to generate dynamic content on
web pages and web applications.
§ CGI, when implemented on a web server provides an
interface between the web server and programs that
generate the web content.
§ These programs are known as CGI scripts or simply CGIs;
they are usually written in a scripting language.

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

CGI on IBM i

§ Means of calling an RPG program from a browser


§ RPG program then responds to the browser
– In the language of the browser: HTML

§ CGIDEV2 and CGICBLDEV2


– IBM i CGI toolset
– http://www.easy400.net/

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Roll your own

§ One example
– http://www-03.ibm.com/systems/i/software/http/examples/samplerpg/
rpg_demo.html

– HTML page
– RPG program
•  Using BNDSRVPGM(qhttpsvr/qzhbcgi)
– HTTP Server
•  Configured to support CGI

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

http://server:port/rpgcgi.html

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

http://server:port/rpgcgi.html

79
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

http://server:port/rpgcgi.html

80
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

RPG CGI program

* Compile-time array for HTML output.


DARRSIZE C 23
DHTML S 80 DIM(ARRSIZE)
PERRCD(1) CTDATA

DBREAK C '<br>'

C BUFOUT CAT HTML(I):0 BUFOUT


C BUFOUT CAT BREAK:0 BUFOUT

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

RPG CGI program

*******************************************************
**** Send BufOut to standard output.
*******************************************************
C CALLB APISTDOUT
C PARM BUFOUT
C PARM BUFOUTLN
C PARM QUSEC

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

RPG CGI program

**CTDATA HTML
CONTENT-TYPE: TEXT/HTML
<html>
<head>
<TITLE>Sample IBM i RPG program executed by HTTP server
as a CGI</title>
</HEAD>
<body>
<H1>SAMPLE IBM i RPG PROGRAM.</H1>
<br><br>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

RPG CGI program

<P>THIS IS SAMPLE OUTPUT UsING IBM i HTTP SERVER CGI


APIS FROM AN RPGPROGRAM. THIS PROGRAM READS THE INPUT
DATA FROM QUERY_STRING ENVIRONMENT VARIABLE WHEN THE
REQUEST_METHOD IS GET AND READS STANDARD INPUT WHEN THE
REQUEST_METHOD IS POST.
<P>SERVER INPUT:<BR>
<P>ENVIRONMENT VARIABLE - REQUEST_METHOD:
<P>ENVIRONMENT VARIABLE - SERVER_SOFTWARE:
</BODY>
</HTML>

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

http://server:port/rpgcgi.html

85
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

Serving RPG or SQL to the web

§ Integrated Web Application Server for IBM i


§ Integrated Web Services for IBM i

§ Web Services
– *PGM
– *SRVPGM

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Navigator for i

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

89
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

90
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

91
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

92
© 2014 Trevor Perry
"What Can i do?" An IBM i Developer's Introduction to Everything!

Serving RPG or SQL to the web

§ Integrated Web Application Server for IBM i


§ Integrated Web Services for IBM i

§ Web Services
– *PGM
– *SRVPGM

§ PCML

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

One more trick!

§ 5250 converted to HTML


§ Now using RPG Open Access to HTML

§ Unique grid scrolling challenge


§ Solved with Javascript and JQuery

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Javascript + JQuery
function FreezeGridHeader() {

// Check for the page up button to be missing


if ($('.look-subfile-pageup').length == 0) {

// Find all the necessary elements


var table = $('.look-datagrid > div > div > div > table');
var tableParent = $('.look-datagrid > div > div > div');
var tableParentHeight = tableParent.height();
var tableHeaderRow = $('.look-datagrid > div > div > div >
table > tbody :first');
var tableHeaderRowHeight = tableHeaderRow.height();

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Javascript + JQuery
// Remove the existing scroll from the table
tableParent.removeStyleProperty('-ms-overflow-y');

// Build the table header & move the header row to it


var theadHTML = "<thead id='tableHeader'></thead>";
table.append(theadHTML);
$('#tableHeader').append(tableHeaderRow);

// Scroll the table


var tableScrollHeight=tableParentHeight-tableHeaderRowHeight;
table.tableScroll({height:tableScrollHeight});

}
}

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Two lines of code that matter


// Remove the existing scroll from the table
tableParent.removeStyleProperty('-ms-overflow-y');

// Build the table header & move the header row to it


var theadHTML = "<thead id='tableHeader'></thead>";
table.append(theadHTML);
$('#tableHeader').append(tableHeaderRow);

// Scroll the table


var tableScrollHeight=tableParentHeight-tableHeaderRowHeight;
table.tableScroll({height:tableScrollHeight});

}
}

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Now you know!

§ Javascript rules!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

Now you know!

§ Javascript rules!

§ Imagine where you can inject a script to manipulate the


user interface
– RPG CGI
– PHP
– ?

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

But, seriously…

§ This is the tip of a very big iceberg!

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

What can i do?

§ Research your options


– Some older techniques apply
– More and more modern tools
§ Most of these tools and technologies are quite simple
– Learning curve is small
– You may already have the tools/editors
– You can start today
§ Commonalities across languages and platforms
– Learn once, re-use many

© 2014 Trevor Perry


"What Can i do?" An IBM i Developer's Introduction to Everything!

What can i do?

§ What do you want it to do?

© 2014 Trevor Perry


Trevor Perry – Chief Architect. Angus Thinks!
March 2014

"What Can i do?”


An IBM i Developer's Introduction
to Everything!

© 2014 Trevor Perry

You might also like