Data area

The DataArea class is an abstract base class that represents an iSeries™ data area object

DataArea

This base class has four subclasses that support the following: character data, decimal data, logical data, and local data areas that contain character data.

Using the DataArea class, you can do the following:

Using the DataArea class causes the AS400 object to connect to the server. See managing connections for information on managing connections.

CharacterDataArea

The CharacterDataArea class represents a data area on the server that contains character data. Character data areas do not have a facility for tagging the data with the proper CCSID; therefore, the data area object assumes that the data is in the user's CCSID. When writing, the data area object converts from a string (Unicode) to the user's CCSID before writing the data to the server. When reading, the data area object assumes that the data is the CCSID of the user and converts from that CCSID to Unicode before returning the string to the program. When reading data from the data area, the amount of data read is by number of characters, not by the number of bytes.

Using the CharacterDataArea class, you can do the following:

DecimalDataArea

The DecimalDataArea class represents a data area on the server that contains decimal data.

Using the DecimalDataArea class, you can do the following:

Example: Using DecimalDataAreaThe following example shows how to create and to write to a decimal data area:
Note: Read the Code example disclaimer for important legal information.
       // Establish a connection to the server "My400".
    AS400 system = new AS400("MyServer");
       // Create a DecimalDataArea object.
    QSYSObjectPathName path = new QSYSObjectPathName("MYLIB", "MYDATA", "DTAARA");
    DecimalDataArea dataArea = new DecimalDataArea(system, path.getPath());
       // Create the decimal data area on the server using default values.
    dataArea.create();
       // Clear the data area.
    dataArea.clear();
       // Write to the data area.
    dataArea.write(new BigDecimal("1.2"));
       // Read from the data area.
    BigDecimal data = dataArea.read();
       // Delete the data area from the server.
    dataArea.delete();

LocalDataArea

The LocalDataArea class represents a local data area on the server. A local data area exists as a character data area on the server, but the local data area does have some restrictions of which you should be aware.

The local data area is associated with a server job and cannot be accessed from another job. Therefore, you cannot create or delete the local data area. When the server job ends, the local data area associated with that server job is automatically deleted, and the LocalDataArea object that is referring to the job is no longer valid. You should also note that local data areas are a fixed size of 1024 characters on the server.

Using the LocalDataArea class, you can do the following:

LogicalDataArea

The LogicalDataArea class represents a data area on the server that contains logical data.

Using the LogicalDataArea class, you can do the following:

DataAreaEvent

The DataAreaEvent class represents a data area event.

You can use the DataAreaEvent class with any of the DataArea classes. Using the DataAreaEvent class, you can do the following:

DataAreaListener

The DataAreaListener class provides an interface for receiving data area events.

You can use the the DataAreaListener class with any of the DataArea classes. You can invoke the DataAreaListener class when any of the following are performed: