× 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.



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>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.