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



Are user spaces like very large Data Areas?

dan


-----Original Message-----
From: Dave Wall [mailto:dawall@us.ibm.com]
Sent: Wednesday, January 23, 2002 9:34 AM
To: java400-l@midrange.com
Subject: Re: User Space



A user space is simply a chunk of iSeries storage.  The length is
established when the space is created, up to 16 meg.  It is named just like
other iSeries objects and goes in a library.  They are created by programs.
They are persistent and can be saved like other iSeries objects.  They are
accessed via an offset/length strategy (read/write x bytes starting at
offset y).  You can create as many as you want.

The Toolbox has a UserSpace class to help Java programs access user space
objects.  A simple program is

  AS400 sys = new AS400("mySystem.myCompany.com");

                    // Create a user space object.
  UserSpace US = new UserSpace(sys, "/QSYS.LIB/MYLIB.LIB/MYSPACE.USRSPC");

                       // Use the create method to create the user space on
                       // the AS/400.
  US.create(10240,                           // The initial size is 10K
            true,                            // Replace if the user space
already exists
            " ",                             // No extended attribute
            (byte) 0x00,                     // The initial value is a null
            "Created by a Java program",     // The description of the user
space
            "*USE");                         // Public has use authority to
the user space


                       // Use the write method to write bytes to the user
space at offset 0.
  US.write("Write this string to the user space.", 0);

User Space objects are often used by iSeries APIs.  When a lot of data is
returned to the caller the API often puts the data in a user space.
Another common use of user spaces is in program to program communication
when the data is too big to fit in a data queue.  In that case the data
queue is used to notify the target program that there is something to do,
but the user space contains the data.  The data queue entry may contain the
user space name, data offset,  length, etc.

One important Toolbox UserSpace consideration -- the UserSpace classes
internally uses other Toolbox objects to access the space.  By default it
uses the IFSFile family of classes (via the stream file server) to access
the space.  The IFSFile classes cannot access data in QTemp, and hold a
lock on the space until the object is closed.  This is the best behavior is
some cases so a implementation using ProgramCall (via the program call
server) also exists.  The ProgramCall implementation can access spaces in
QTemp and holds a lock on the space only during a method call, but it is
slower than IFS access.  To get the ProgramCall implementation use
UserSpace.setMustUseProgramCall(true);

David Wall
AS/400 Toolbox for Java




                      "Richards, Etienne
                      (CAP, PTL)"               To:       
"'java400-l@midrange.com'" <java400-l@midrange.com>
                      <Etienne.Richards@        cc:
                      penske.com>               Subject:  User Space
                      Sent by:
                      java400-l-admin@mi
                      drange.com


                      01/23/2002 07:09
                      AM
                      Please respond to
                      java400-l





All,

Can someone please tell me more about a user space.

How would you read or write to a user space?
How do I know if I have a user space and what is it called?
Can you access a user space from the Toolbox?

Etienne
_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.





_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.