Dieter,
@namespaces: If you want namespaces you can just create them yourself by
naming your procedures like mynamespace_myproc().
@multithreading: I have never had the need for it in nearly 40 years of
development, but I’m only an application and framework developer and
normally leave the more technical development such as low level socket
connections to people like Scott.
I do however use multiprocessing since my UI clients (HTML or EXTJS based)
uses AJAX that can have several connections to the same server running at
the same time.
@event driven: I agree with Scott that most events that trigger server
events from a RPG application perspective happen in the UI. But other
events could be triggers on DB PF or events that happen in data queues, but
all those are covered in RPG.
“event driven” is to me like SOA, REST, CRUD, MVC and a lot of other
definitions a question of how narrow you use the definition in a world with
many overlapping definitions and technologies and buzzwords – it’s a little
like "you say tomato, I say tomahto, you say table, I say file, you say
row, I say record" etc. J
5250 events:
This form of event handling has been done for years; the real event
listener is of course in the 5250 UI processor and not in the RPG program
itself that only reacts on passed keyboard events and data from the 5250
processor that in old days was a special piece of hardware with its own
processor for each 28 devices.
Exfmt ABC;
Select;
When *inka = *on;
// F1 pressed
When *inkb = *on;
// F2 pressed
Other;
// enter pressed
Endsl;
CGIDEV2 call back event:
This is very similar to most PHP and ASP.NET monolithic server pages
because the call back are made to the same URI (CGI program) that initial
generated/loaded the HTML page. However Apache allows the same CGI program
to exist under several QZSRCGI instances so if the call backs are done with
AJAX several call backs can be processed simultaneous. But as in 5250 the
event listener that triggers events isn’t on the server it is in the client
– in this case the browser.
Func = zhbGetVar(‘func’);
Select;
When func = ‘A’;
doFuncA();
when func = ‘B’;
doFuncB();
Other;
doInitialLoad();
Endsl;
wrtSection(‘*fini’);
Return;
SOA Event:
In SOA, services that deliver data are generic services that aren’t part of
the load of the initial page (the view and the controller). However these
services may also in themselves have events such as CRUD services. Since
the SOA services isn’t part of a monolithic or state full program that may
have to process requested events sequential to a known client and since
these SOA services may be active under each QZSRCGI instance the server can
process multiple requests at the same time even from the same client.
An example of this scenario is when an accordion menu structure is loaded.
The main menu may have N application areas that have to be loaded so the
client calls a generic SOA menu service that returns a JSON structure that
is rendered under the N application main areas. Since this is done by
asyncrone AJAX the client establish N connections to the server at the same
time:
http://www.powerext.com/accordion.jpg
Partial Initial Client OO javascript Code:
// define the remote service to a combo field
{fieldLabel : "Field Name"
,xtype : "combo"
,store : new Ext.data.JsonStore({
url :
"/pextcgi/PXCRPXXR.pgm"
,baseParams:{
ses :
"14325230080277328020122154530008"
,req :
"00223869440263948020122106540044"
,func : "getRows"
,valueField : "XVXRID"
,displayField : "select"
,filterId1 : ""
,filterId2 : ""
,filterId3 : ""
}
})
}
// apply keyboard event listeners
,listeners: {
change: {
fn:function(combo, value) {
}
}
,focus: {
fn:function(combo, value)
{
combo.store.reload();
}
}
}
Server side RPG:
Func = getExtVar(‘func’);
Select;
When func = ‘getRows’;
doGetRows();
Other;
jsonNode(’*object’);
jsonNode(’*boolean’:’succes’:’false’);
jsonNode(’*string’:’errormessage’
:’Requested function unknown’);
jsonEndNode();
Endsl;
echoToClient();
return;
@control activation: RPG isn’t an OO language; it is procedural as most
transactional systems are (such as ERP). But since RPG runs under ILE you
can make OO procedures in JAVA or C/C++ and then use them in RPG.
Many of us that uses QC2LE routines already uses “NEW” and OO in RPG many
perhaps without knowing it, just think about open64, read, write, close.
Open64 gives us a NEW file handle, read, write and close all uses the given
file handle to process the file.
And here is another example of “NEW” from Scott’s implementation of Apache
JAVA POI in RPG:
book = new_HSSFWorkbook(); // create a new book
sheet = ss_newSheet(book:title); // create a sheet within the book
You state that there are few components available, but if you include the
ILE environment that efficient makes it possible to mix JAVA, C/C++, COBOL,
CL and RPGLE components there is theoretical a lot not to mention the
possibilities the PHP implementation and components gives.
If you compare one language with another there will always be pros and
cons, but IMO you should also compare them by the tasks they have been
constructed to serve, the tasks they have proved to be efficient to solve
and the overall environment that they live in and in that perspective RPG
isn’t dying even though it may miss a feature or two compared with OO
languages such as JAVA or C/C++.
So the discussion is more or less pointless even if suggestions are
welcome, but if you use a JAVA binocular, it is very easy to see what RPG
misses exactly as if you use a RPG binocular it is very easy to see what
JAVA misses.
I have personally newer “hit the wall” in the RPG/ILE environment even
though I also program routines in RPG that uses “Modified Preorder
Tree-Traversal Algorithms” that do require recursive procedure calls which
RPG supports under certain conditions.
The bottom line is that an IBM I am what it claims to be – an International
Business Machine – an (Business) Application Server (AS) and not a WARCRAFT
gaming server, a CHAT or a DATING server and that reflects the OS
optimizing, the product development, the products and the languages that
are available on the platform.
On Tue, Feb 21, 2012 at 7:29 AM, D*B <dieter.bender@xxxxxxxxxxxx> wrote:
Scott,
@namespaces: I'm talking about modularisation and if it is possible to
give a procedure the name read if it is reading something and if I could
use this procedure without naming conflicts together with other procedures
read in the same context. Using RPG this would not work and this is in
contradiction to use meaningfull names.
@multi threading: using H option THREAD(*SERIALIZE) you loose
Multithreading, using THREAD(*CONCURRENT) first you are loosing shared
memory, using static(*ALLTHREAD) you will get it back, but RPG has no
synchronisation constructs and you would have to code this on your own.
There are languages out (not only java!) it's much easier to code multi
threaded applications.
@event driven and multithreading: keying events is only half of the truth!
especeally if you want the reaction to other events in real time, because
there is someone sitting and waiting...
@error handling: I'm talking about the relation between compile time error
checking and runtime errors and if you want to write stable code (in other
words: there are people out, who want to check errors in their code!!!) you
would have no assistance using RPG, because the compiler doesn't care (and
know) about errors, which might occur at runtime.
@multiple connections: If you are writing transaction safe code (in other
words: if you use commitment controll) you need multiple connections all
time and using RPG you would have to use ugly work arounds with diffrent
Activation Groups. And using Server mode or SQL CLI is much more
complicated than normal embedded SQL.
@controll Activation: all OO languages and some other do! In Java the
magic word is new
@opinion: yes, that's my opinion (what else should it be?) and I was
thinking that we are discussing opinions, so that everybody could make the
decision for himself, what is needed and how to do it!
Dieter
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.