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



I'm thinking out loud here...

...for those of us who are repelled by the idea of delving into
mi to lock a user space however we do utilize user spaces where beneficial,
wouldn't we derive the same anti-lock capabilities using the ALCOBJ
command..?

(We don't want to scare people away from user spaces :-)


searched IBM site, from programming api's --

<Snip>
The Retrieve Pointer to User Space (QUSPTRUS) API retrieves a pointer
to the contents of a user-domain user space. The data in that user space
then can be directly manipulated by high-level language programs that
support pointers, such as C or COBOL. The QUSPTRUS API will not return
a pointer to a system-domain user space; you must use system APIs to
access system-domain user spaces. If you attempt to retrieve the
pointer to a system-domain user space, an error will be returned.

The QUSPTRUS API even returns a pointer to an object that is subject
to an exclusive (*EXCL) lock. If you create application programs using
HLLs that can directly update user spaces using pointers
(instead of using the Change User Space (QUSCHGUS) API), you should
use your own synchronization data methods. You can use one of the
following methods to avoid updates at the same time to the same location
within a user space:

CMPSW MI instruction 
CMPSWP MI instruction 
LOCK MI instruction 
LOCKSL MI instruction 
Allocate Object (ALCOBJ) command 

Use of the QUSPTRUS API does not update the object usage information
(such as last changed date, last date used, and so on). You should use
the Change User Space or the Retrieve User Space API to update the
object usage information if needed.
</Snip>

John B.



----------------------------------------------------------------------

message: 1
date: Thu, 12 Feb 2004 13:08:38 -0500
from: "Steve Richter" <srichter@xxxxxxxxxxxxx>
subject: RE: User space

everything scott says in right on target. I would add that there is a way to
syncronize access to a user space amoung multiple jobs.

http://publib.boulder.ibm.com/iseries/v5r1/ic2924/tstudio/tech_ref/mi/LOCKSL
.htm

LOCKSL ( lock space location ) accepts a pointer to a space location and
effectively locks it from use by other jobs that also use LOCKSL before
accessing the space location.

-Steve


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Scott Klement
Sent: Thursday, February 12, 2004 12:29 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: User space



On Thu, 12 Feb 2004, Raul A Jager wrote:
>
> I need to share data between users.
>
> Can I use an "USER SPACE"?

Sure.


> Will the system allow several users updating it?

Yes, but IMHO, not gracefully.

>  when will the upates be seen by others?

As soon as they check for the updates.


A user space is similar to a file, except for three things:

a) It does not have any particular structure.

b) Since there are no records, there's no record locks, etc.

c) It's directly addressable with a pointer from an HLL program.
   (Technically, you can do that with any file, but you need to use MI
    tricks rather than normal HLL operations with non-userspaces)

The big problem is making sure that two jobs don't conflict with one
another.  You have to be very careful about any situation that could lead
to two processes writing data to it at the same time.

I recommend having the jobs communicate with each other using data queues
so that they can synchronize their operations -- preventing them from
conflicting with one another.

But, since they can send data to one another via the data queues, the
question becomes, do you still need the user space?   The only reason I
can think of why you'd want to use a user space for something like this
would be if the data that needs to be accessed is very large.  With a user
space they are sharing a common piece of information, but with data queues
the info is copied from one to the other -- so for very large pieces of
information, user spaces would be quicker.

Hope that makes sense...
_______________________________________________
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:

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.