com.ibm.as400.access
Class DecimalDataArea
- java.lang.Object
-
- com.ibm.as400.access.DataArea
-
- com.ibm.as400.access.DecimalDataArea
-
- All Implemented Interfaces:
- java.io.Serializable
public class DecimalDataArea extends DataArea implements java.io.Serializable
The DecimalDataArea class represents a decimal data area on the system.The following example demonstrates the use of DecimalDataArea:
// Prepare to work with the system named "My400". AS400 system = new AS400("My400"); // 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 system 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 system. dataArea.delete();
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DecimalDataArea()
Constructs a DecimalDataArea object.DecimalDataArea(AS400 system, java.lang.String path)
Constructs a DecimalDataArea object.
-
Method Summary
Methods Modifier and Type Method and Description void
clear()
Resets the data area to contain 0.0.void
create()
Creates a decimal data area on the system.void
create(int length, int decimalPositions, java.math.BigDecimal initialValue, java.lang.String textDescription, java.lang.String authority)
Creates a decimal data area with the specified attributes.void
delete()
Removes the data area from the system.int
getDecimalPositions()
Returns the number of digits to the right of the decimal point in this data area.java.lang.String
getPath()
Returns the integrated file system path name of the object represented by the data area.java.math.BigDecimal
read()
Returns the data read from the data area.void
setPath(java.lang.String path)
Sets the fully qualified data area name.void
write(java.math.BigDecimal data)
Writes data to the data area.-
Methods inherited from class com.ibm.as400.access.DataArea
addDataAreaListener, addPropertyChangeListener, addVetoableChangeListener, getLength, getName, getSystem, refreshAttributes, removeDataAreaListener, removePropertyChangeListener, removeVetoableChangeListener, setSystem
-
-
-
-
Constructor Detail
-
DecimalDataArea
public DecimalDataArea()
Constructs a DecimalDataArea object. It creates a default DecimalDataArea object. The system and path properties must be set before attempting a connection.
-
DecimalDataArea
public DecimalDataArea(AS400 system, java.lang.String path)
Constructs a DecimalDataArea object. It creates a DecimalDataArea instance that represents the data area path on system.- Parameters:
system
- The system that contains the data area.path
- The fully qualified integrated file system path name. The integrated file system file extension for a data area is DTAARA. An example of a fully qualified integrated file system path to a data area "MYDATA" in library "MYLIB" is: /QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA
-
-
Method Detail
-
clear
public void clear() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Resets the data area to contain 0.0.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the system object does not exist.
-
create
public void create() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException
Creates a decimal data area on the system. This method uses the following default property values.- length - 15 digits.
- decimalPositions - 5 digits.
- initialValue - A value of 0.0.
- textDescription - A blank string.
- authority - A value of *LIBCRTAUT.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectAlreadyExistsException
- If the system object already exists.ObjectDoesNotExistException
- If the system object does not exist.
-
create
public void create(int length, int decimalPositions, java.math.BigDecimal initialValue, java.lang.String textDescription, java.lang.String authority) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException
Creates a decimal data area with the specified attributes.- Parameters:
length
- The maximum number of digits in the data area. Valid values are 1 through 24.decimalPositions
- The number of digits to the right of the decimal point. Valid values are 0 through 9.initialValue
- The initial value for the data area.textDescription
- The text description for the data area. The maximum length is 50 characters.authority
- The public authority level for the data area. Valid values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name of an authorization list. The maximum length is 10 characters.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectAlreadyExistsException
- If the system object already exists.ObjectDoesNotExistException
- If the system object does not exist.
-
delete
public void delete() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Removes the data area from the system.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist.
-
getDecimalPositions
public int getDecimalPositions() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of digits to the right of the decimal point in this data area.- Returns:
- The number of decimal positions.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.IllegalObjectTypeException
- If the system object is not the required type.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the system object does not exist.
-
getPath
public java.lang.String getPath()
Returns the integrated file system path name of the object represented by the data area.- Returns:
- The integrated file system path name of the object represented by the data area.
-
read
public java.math.BigDecimal read() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the data read from the data area.- Returns:
- The decimal data read from the data area.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.IllegalObjectTypeException
- If the system object is not the required type.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the system object does not exist.
-
setPath
public void setPath(java.lang.String path) throws java.beans.PropertyVetoException
Sets the fully qualified data area name. The following example demonstrates the use of setPath:// Create a DecimalDataArea object. DecimalDataArea dataArea = new DecimalDataArea(); // Set its path to be the data area "MYDATA" in the library "MYLIB". dataArea.setPath("/QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA");
- Parameters:
path
- The fully qualified integrated file system path name of the data area.- Throws:
java.beans.PropertyVetoException
- If the change is vetoed.
-
write
public void write(java.math.BigDecimal data) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Writes data to the data area.- Parameters:
data
- The decimal data to be written.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the system object does not exist.
-
-