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



Joe,

AFAIK, your thinking is correct...

One option you haven't seemed to have considered....store the array in
a user space/user index ...then use based DS's in your program...

Not sure off the top of my head how to ensure the space stays in main
memory, SETOBJACC doesn't support but *PGM and *FILE at least at
v5r4....but I'm pretty sure I've seen a technique to do this...

Tada, memory shared between jobs...

HTH,
Charles


On Tue, Jul 5, 2011 at 1:12 PM, Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx> wrote:
Back in the olden days, one of the things that was so efficient about
the midrange was the way it used a shared, read-only section of memory
for the program code.  That way, 20 people using order entry would use
only one copy of the program.  The variables specific to a given job
were stored in the job itself (in the Process Access Group, if I
remember correctly).

My question is how much of that still holds today?  Here's what I'm
wondering about.  I'd like to create a service program that provides
data from a table.  That table is static; it will not change during the
life of the job and most likely only needs to be refreshed at IPL.

I could use a database table and pin the table to memory with SETOBJACC,
but that still means I have to go through a layer of DB management each
time I want a value.  Unless things have changed drastically, having an
array in my program will still be faster, especially if I have an
ordered array with a relatively small number of elements (measured in
the 100s at most) and then load that table at initialization time.  Even
if the data is 1K in length, I'm talking less than 1MB of memory.
However, what I don't want is 100 user jobs to create 100 copies of that
table; now I'm talking megabytes and as the number of tables and users
grows, so does the used (duplicated) memory.

So, is there a way to have a static chunk of memory that is shared by
all the jobs that call this service program?  The program code will
certainly be shared, but what about the data?  If I create an array in
my D-specs, as far as I know I can't make it read only.  Therefore it
has to be in the PAG (or whatever the equivalent is), and thus is
repeated per job.

The more I look at it, the more it seems that SETOBJACC is my best bet
and that I have to choose between speed and memory usage.  I suppose I
can share a single user space among multiple jobs.  Or a user index,
perhaps?  I always wonder about those sorts of objects, though, since
every request requires a fully qualified object name.  How often do
those get resolved?

Thoughts?

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

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.