I apologize for my recent diatribes. I really let myself get taken off
track of what I was trying to present. And I really got upset when it was
implied that my statement of creating a small program in 15 minutes was less
than factual.
What killed me is that I had just the day before submitted an article to IBM
Systems Magazine, which will be published in February. And while I don't
want to publish all the contents of that article here for obvious reasons, I
will say that in the article I detail the 15 minutes I spent creating both a
CRUD application and a QUERY application over a standard physical file.
The results of the query application can be seen here:
http://www.plutabrothers.com/PBDWeb/special/Figure8.png
It's just a screen shot of the application, which lists the data from the
file both in a table and in a summarized pie chart.
There are two pieces of code. One is the part that defines the records,
much like the DDS for externally described data structures:
package data;
Record OrderDetail type SQLRecord
OHCUST decimal(8);
OHSTATUS string;
OHORDER decimal(8);
OHAMOUNT decimal(11,2);
end
Record CategoryTotals type SQLRecord
Category String {column="Category"};
Total decimal(11,2) {column="Total"};
end
That defines two records, one for the list and one for the totals. And you
can of course reuse those records over and over again in other applications,
just the same as you would an EDS. The job of your program then is simply
to create arrays of that data. The EGL code to populate those totals:
package jsfhandlers;
import data.*;
handler OrderSummary type JSFHandler
{onPrerenderFunction = onPrerender,
view = "OrderSummary.jsp"}
details OrderDetail[0];
categoryTotals CategoryTotals[0];
// Function Declarations
function onPrerender()
get details with
#sql{
select
OHCUST, OHSTATUS, OHORDER, OHAMOUNT
from EGLCHART.ORDHDR
order by OHSTATUS, OHCUST
};
get categoryTotals with
#sql{
select DIGITS(OHCUST) CONCAT '/'
CONCAT OHSTATUS AS CATEGORY,
SUM(OHAMOUNT) AS TOTAL
from EGLCHART.ORDHDR
group by OHCUST, OHSTATUS
};
end
end
That's it. Then you have to create a JSF page (basically, the display
file). I created the page using simple drag and drop. I dragged the array
named "details" onto the page and the editor formatted the table. Next I
dragged a Chart widget onto the page and then dropped the array named
"categoryTotals" onto it. I used the chart's properties form to select
which column went in the X-axis and which in the Y-axis, added titles, and
boom I was done.
So, did it take 15 minutes? No.
This particular page took about SEVEN minutes to create AND RUN right in the
WDSC workbench (and the steps are documented in the article). Is it
beautiful? No, but it's FINISHED from a programming standpoint. At this
point, you hand off the JSF page to the designer who can do whatever they
want with it. It's completely CSS driven meaning they can change the fonts,
colors, whatever without changing a line of your business logic. The
Rational tooling let's them add navigation and "presence" (logos and banners
and so on) and so on without changing the EGL.
In fact, they (the designers) can create templates that YOU can assign to
the page ahead of time so that it comes out web-site ready. This means that
even a one-man shop can use the tool to create consistent web pages.
Would this make your life a little easier? I think so. And while this was
written entirely in SQL, it's pretty easy to change the "get" opcodes to a
loop with a "call" opcode which calls an RPG program. I've published
examples of that code in previous articles.
So in summary, is EGL perfect? No. Is JSF going to work for everything?
No. But if I can create applications like this in minutes, is it something
that's going to help me put data in front of the C-level executives and
fulfill their information needs in a way that shows that the System i is a
modern, leading edge platform?
Yeah, I think so.
Joe
As an Amazon Associate we earn from qualifying purchases.