× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Matt,

I think I can argue that there is a lot that is stateless to telnet and that
browsing is just telnet that allows the user to start up as many sessions as
they want and navigate easily between sessions.  But I dont want to get
kicked off the list so I'll just say its a possible example of how threads
can help an rpg programmer do their work.

I just figured I would ask Hans the technical reasons for threads not being
supported in RPG.  Threads are not as mysterious as people might think they
and they help programmers solve problems.

-Steve

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Haas, Matt
Sent: Tuesday, May 20, 2003 1:33 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: threading in rpg. was RPG and Web.. (was Using OO
conceptsinRPG)


Steve,

Maybe this is just a bad choice of examples but HTTP doesn't work like your
example suggests it would. Unlike 5250, HTTP is not stateful. There have
been all sorts of attempts (like persistent CGI, which I don't recall
hearing about anyone ever getting it to work they way it should) to make it
do this but unless your application persists the data (either in a database
like Hans suggested or some in-memory store like Java uses -- btw, you could
probably do this with data queues), multi-threaded programs aren't going to
solve this problem because once the response is sent back to the user, your
program isn't going to be around.

What you are talking about doing can be handled by programming using a
model-view-controller programming model. Struts is a widely used example of
this.

The thing to keep in mind that whatever language you are using and whatever
programming model you use to write the programs, HTTP is still stateless and
you can't change that.

Matt

<snip>
cgi web programming in rpg gets tedious right from the start because you
cant program a simple "prompt the user to enter some information, then
continue running after they click OK" requirement without all the
persistance, reentrant stuff.

In a display file pgm you code:
   FillTheScreen( ... ) ;
   Exfmt PromptRcd ;
   if  *inkc = '1' ;
     return ;
   endif ;
   ProcessTheEntries( ... ) ;

In a cgi web program you cant do this.  As soon as you do the http
equivalent of "exfmt" the state info has to be saved and the job ended.
Then another program, in another job is run when the browser user clicks ok
to send back the entered information.

With threads, it might be possible to start a 2nd thread to handle the http
equivalent of the "exfmt" stmt.  The idea being that the pgm logic thread,
the one that contains the "exfmt" stmt just waits for other threads to deal
with all the disjointed stuff going on as the browser user maybe responds to
the prompt or maybe jumps to another page at your web site.

If it works, this can be done with jobs, but threads will run faster and
using jobs prevents the use of global to all threads variables.

Just an example of how an rpg programmer could use threads.
<snip>

_______________________________________________
This is the RPG programming on the AS400 / iSeries (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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.