com.ibm.as400.access

Class LocalDataArea

  • All Implemented Interfaces:
    Serializable


    public class LocalDataArea
    extends DataArea
    implements Serializable
    The LocalDataArea class represents a local data area on the system.

    A local data area exists as a character data area on the system. It is automatically associated with a job and cannot be accessed from another job; hence, it cannot be directly created or deleted by the user.

    Care must be taken when using local data areas so that the IBM i job is not ended prematurely. When the job ends, its local data area is automatically deleted, at which point the LocalDataArea object that is referencing it will no longer be valid.

    The following example demonstrates the use of LocalDataArea:

    // Prepare to work with the system named "My400".
    AS400 system = new AS400("My400");
    
    // Create a LocalDataArea object to access
    // the local data area associated with this connection.
    LocalDataArea dataArea = new LocalDataArea(system);
    
    // Clear the data area
    dataArea.clear();
    
    // Write to the data area
    dataArea.write("Hello world");
    
    // Read from the data area
    String data = dataArea.read();
    

    Note: Most of the read() and write() methods of this class automatically convert characters between Unicode and the CCSID associated with the AS400 object. See AS400.getCcsid().

    See Also:
    Serialized Form