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



Steal away, Bob.  That's why I shared the idea in the first place!

Another advantage of this technique is that different CGI programs with totally
different data structures and subfields, can use the same code to create and
extend a user space, and retrieve a user space's pointer.

Further, you can store repeating structures in the space and use C's qsort and
bsearch on them.

And,  retrieving a pointer is a lot more efficient than chaining to a file.

When I find the time, I'll probably add user space subprocedures to CGIDEV2.


Mel Rothman, CGIDEV2 Author
IBM eServer Custom Technology Center (eCTC), Rochester, Minnesota
http://www-1.ibm.com/servers/eserver/iseries/service/ctc/
http://www.easy400.ibm.it/en

"Bob Cozzi (RPGIV)" wrote:
>
> Mel,
>
> Great idea, I'm going to consider stealing it for this new app I'm
> writing.
> I was considering creating a database file that did, effectively, the
> same thing using a session ID. Then just chain out to the file to see if
> that session ID was there.
>
> But the advantage I see in using a user space is that by getting a
> pointer to the user space (using the API) you can map its data into that
> Based() data structure, and effectively you've externally described the
> data structure.
> And, if you put a date/timestamp in the user space, you could easily
> write a clean out program that just went out and deleted user space
> object with a time stamp older than X.
>
> The other advantage is you can add additional fields to the data
> structure without the need to create the database file. While that might
> not be too be an issue for some, in which case they may want to consider
> using a file, for other with high-transactions per hour, you could
> recompile your program with the next data structure layout, and put it
> into production.
>
> Bob Cozzi
> cozzi@rpgiv.com
> Visit the on-line Midrange Developer forum at: http://www.rpgiv.com
>
> > -----Original Message-----
> > From: web400-admin@midrange.com [mailto:web400-admin@midrange.com] On
> Behalf
> > Of Mel Rothman
> > Sent: Saturday, December 22, 2001 10:18 AM
> > To: web400@midrange.com
> > Subject: Re: [WEB400] Web development on the iSeries using CGI and the
> > CGIDEV2library
> >
> > Mike, instead of sending your CgiDS to and from the browser, you could
> store
> > it
> > in a user space on the host and send only the space name back and
> forth.
> >
> > I use this technique successfully.  It is fast, easy, and secure.
> >
> > Here's how I do it.
> >   1. Declare the data area as based.
> >   1. Store all user spaces, one per logical user session, in a
> separate
> > library.  This makes cleanup easy.
> >   2. When a new user comes in, use CGIDEV2's random subprocedure to
> generate a
> > new user space name, verify that a space with that name doesn't exist
> in the
> > space library, create the space (QUSCRTUS API), and make the space
> > automatically
> > extendible (QUSCUSAT API).  If the name already exists, generate
> another name.
> > All of this could be written into one subprocedure.
> >   3. Retrieve a pointer to the user space (QUSPTRUS API), using the
> pointer
> > assigned to the based data structure.  At this point, all the data
> area's
> > subfields are in the user space.
> >   4. Process the user's inputs, storing any state information in the
> data
> > structure's subfields, and write output to the browser, including a
> hidden
> > field
> > with the user space's name.
> >   5. Upon the next input from any user, if there is a user space
> field, use
> > that
> > name to retrieve a pointer to that space.  At that point, the data
> area will
> > contain that user's information.
> >   6. When you want to end the user's logical session, send a response
> without
> > the user space name.  You could either delete the space or update a
> subfield
> > to
> > indicate logical deletion.  In either case, you would have to write
> some code
> > to
> > handle a user coming in with a logically deleted session.
> >
> > The same CGI program running in a named activation group can handle
> many users
> > because each time it runs, it works with the data created for that
> user as
> > determined by the user space name.
> >
> > I hope this helps.
> >
> > Mel Rothman, CGIDEV2 Author
> > IBM eServer Custom Technology Center (eCTC), Rochester, Minnesota
> > http://www-1.ibm.com/servers/eserver/iseries/service/ctc/
> > http://www.easy400.ibm.it/en
> >
> >

... snip


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.