com.ibm.as400.access
Class KeyedFile
- java.lang.Object
-
- com.ibm.as400.access.AS400File
-
- com.ibm.as400.access.KeyedFile
-
- All Implemented Interfaces:
- java.io.Serializable
public class KeyedFile extends AS400File implements java.io.Serializable
The KeyedFile class represents a physical or logical file on the system. It allows the user to do the following:- Create a physical file by:
- Specifying a record length.
- Specifying an existing DDS source file.
- Specifying a RecordFormat object that contains a description of the record format for the file.
- Access the records in a file sequentially or by key. Note: The read...() methods of this class return records in key order.
- Write records to a file sequentially or by key.
- Update records in a file sequentially or by key.
- Lock a file for different types of access.
- Use commitment control when accessing a file. The user can:
- Start commitment control for the connection.
- Specify different commitment control lock levels for the individual files being accessed.
- Commit and rollback transactions for the connection.
- Delete a physical or logical file or member.
- FileEvent
The events fired are:- FILE_CLOSED
- FILE_CREATED
- FILE_DELETED
- FILE_MODIFIED
- FILE_OPENED
- PropertyChangeEvent
- VetoableChangeEvent
- See Also:
MemberList
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static int
KEY_EQ
Constant indicating search type of equal.static int
KEY_GE
Constant indicating search type of greater than or equal.static int
KEY_GT
Constant indicating search type of greater than.static int
KEY_LE
Constant indicating search type of less than or equal.static int
KEY_LT
Constant indicating search type of less than.protected static int[]
TYPE_TABLE
-
Fields inherited from class com.ibm.as400.access.AS400File
BLANK, COMMIT_LOCK_LEVEL_ALL, COMMIT_LOCK_LEVEL_CHANGE, COMMIT_LOCK_LEVEL_CURSOR_STABILITY, COMMIT_LOCK_LEVEL_DEFAULT, COMMIT_LOCK_LEVEL_NONE, longRecordNumber, READ_ALLOW_SHARED_READ_LOCK, READ_ALLOW_SHARED_WRITE_LOCK, READ_EXCLUSIVE_LOCK, READ_ONLY, READ_WRITE, SOURCE_MEMBER_TEXT, TYPE_DATA, TYPE_SOURCE, WRITE_ALLOW_SHARED_READ_LOCK, WRITE_ALLOW_SHARED_WRITE_LOCK, WRITE_EXCLUSIVE_LOCK, WRITE_ONLY
-
-
Constructor Summary
Constructors Constructor and Description KeyedFile()
Constructs a KeyedFile object.KeyedFile(AS400 system, java.lang.String name)
Constructs a KeyedFile object.
-
Method Summary
Methods Modifier and Type Method and Description void
deleteRecord(byte[] key, int numberOfKeyFields)
Deletes the record specified by key.void
deleteRecord(java.lang.Object[] key)
Deletes the record specified by key.void
positionCursor(byte[] key, int numberOfKeyFields)
Positions the file cursor to the first record matching the specified key.void
positionCursor(byte[] key, int searchType, int numberOfKeyFields)
Positions the file cursor to the first record meeting the specified search criteria based on key.void
positionCursor(java.lang.Object[] key)
Positions the file cursor to the first record matching the specified key.void
positionCursor(java.lang.Object[] key, int searchType)
Positions the file cursor to the first record meeting the specified search criteria based on key.void
positionCursorAfter(byte[] key, int numberOfKeyFields)
Positions the file cursor to the first record after the record specified by key.void
positionCursorAfter(java.lang.Object[] key)
Positions the file cursor to the first record after the record specified by key.void
positionCursorBefore(byte[] key, int numberOfKeyFields)
Positions the file cursor to the first record before the record specified by key.void
positionCursorBefore(java.lang.Object[] key)
Positions the file cursor to the first record before the record specified by key.Record
read(byte[] key, int numberOfKeyFields)
Reads the first record with the specified key.Record
read(byte[] key, int searchType, int numberOfKeyFields)
Reads the first record meeting the specified search criteria based on key.Record
read(java.lang.Object[] key)
Reads the first record with the specified key.Record
read(java.lang.Object[] key, int searchType)
Reads the first record meeting the specified search criteria based on key.Record
readAfter(byte[] key, int numberOfKeyFields)
Reads the first record after the record with the specified key.Record
readAfter(java.lang.Object[] key)
Reads the first record after the record with the specified key.Record[]
readAll()
Reads all the records in the file.Record
readBefore(byte[] key, int numberOfKeyFields)
Reads the first record before the record with the specified key.Record
readBefore(java.lang.Object[] key)
Reads the first record before the record with the specified key.Record
readNextEqual()
Reads the next record whose key matches the full key of the current record.Record
readNextEqual(byte[] key, int numberOfKeyFields)
Reads the next record whose key matches the specified key.Record
readNextEqual(java.lang.Object[] key)
Reads the next record whose key matches the specified key.Record
readPreviousEqual()
Reads the previous record whose key matches the key of the current record.Record
readPreviousEqual(byte[] key, int numberOfKeyFields)
Reads the previous record whose key matches the specified key.Record
readPreviousEqual(java.lang.Object[] key)
Reads the previous record whose key matches the specified key.void
setLongRecordNumber(boolean v)
Set to read records with Record Number in long type.void
update(byte[] key, Record record, int numberOfKeyFields)
Updates the record specified by key.void
update(byte[] key, Record record, int searchType, int numberOfKeyFields)
Updates the first record meeting the specified search criteria based on key.void
update(java.lang.Object[] key, Record record)
Updates the record specified by key.void
update(java.lang.Object[] key, Record record, int searchType)
Updates the first record meeting the specified search criteria based on key.-
Methods inherited from class com.ibm.as400.access.AS400File
addFileListener, addPhysicalFileMember, addPropertyChangeListener, addVetoableChangeListener, close, commit, commit, create, create, create, create, delete, deleteCurrentRecord, deleteMember, endCommitmentControl, endCommitmentControl, finalize, getBlockingFactor, getCommitLockLevel, getExplicitLocks, getFileName, getLibraryName, getMemberName, getPath, getRecordFormat, getSystem, isCommitmentControlStarted, isCommitmentControlStarted, isOpen, isReadNoUpdate, isReadOnly, isReadWrite, isSSPFile, isWriteOnly, lock, open, open, positionCursorAfterLast, positionCursorBeforeFirst, positionCursorToFirst, positionCursorToLast, positionCursorToNext, positionCursorToPrevious, read, readFirst, readLast, readNext, readPrevious, refreshRecordCache, releaseExplicitLocks, removeFileListener, removePropertyChangeListener, removeVetoableChangeListener, rollback, rollback, runCommand, setPath, setReadNoUpdate, setRecordFormat, setRecordFormat, setRecordFormat, setRecordFormat, setSSPFile, setSystem, startCommitmentControl, startCommitmentControl, update, write, write
-
-
-
-
Field Detail
-
KEY_EQ
public static final int KEY_EQ
Constant indicating search type of equal.- See Also:
- Constant Field Values
-
KEY_GT
public static final int KEY_GT
Constant indicating search type of greater than.- See Also:
- Constant Field Values
-
KEY_GE
public static final int KEY_GE
Constant indicating search type of greater than or equal.- See Also:
- Constant Field Values
-
KEY_LT
public static final int KEY_LT
Constant indicating search type of less than.- See Also:
- Constant Field Values
-
KEY_LE
public static final int KEY_LE
Constant indicating search type of less than or equal.- See Also:
- Constant Field Values
-
TYPE_TABLE
protected static final int[] TYPE_TABLE
-
-
Constructor Detail
-
KeyedFile
public KeyedFile()
Constructs a KeyedFile object.
-
KeyedFile
public KeyedFile(AS400 system, java.lang.String name)
Constructs a KeyedFile object. It uses the specified file. If the name for the file does not include a member, the first member of the file will be used.- Parameters:
system
- The system to which to connect. The system cannot be null.name
- The integrated file system pathname of the file. The name cannot be null.
-
-
Method Detail
-
setLongRecordNumber
public void setLongRecordNumber(boolean v)
Set to read records with Record Number in long type.- Parameters:
v
-
-
deleteRecord
public void deleteRecord(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Deletes the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported. The number of elements in key cannot exceed the number of key fields in the record format for this file.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
deleteRecord
public void deleteRecord(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Deletes the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key. This number cannot exceed the total number of key fields in the record format for this file.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursor
public void positionCursor(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record matching the specified key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursor
public void positionCursor(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record matching the specified key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursor
public void positionCursor(java.lang.Object[] key, int searchType) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record meeting the specified search criteria based on key. The searchType indicates that the cursor should be positioned to the record whose key first meets the search criteria when compared to key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.searchType
- Constant indicating the type of match required. Valid values are:- KEY_EQ
First record whose key is equal to key. - KEY_LT
First record whose key is less than key. - KEY_LE
First record whose key is less than or equal to key. - KEY_GT
First record whose key is greater than key. - KEY_GE
First record whose key is greater than or equal to key.
- KEY_EQ
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursor
public void positionCursor(byte[] key, int searchType, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record meeting the specified search criteria based on key. The searchType indicates that the cursor should be positioned to the record whose key first meets the search criteria when compared to key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.searchType
- Constant indicating the type of match required. Valid values are:- KEY_EQ
First record whose key is equal to key. - KEY_LT
First record whose key is less than key. - KEY_LE
First record whose key is less than or equal to key. - KEY_GT
First record whose key is greater than key. - KEY_GE
First record whose key is greater than or equal to key.
- KEY_EQ
numberOfKeyFields
- The number of key fields contained in the byte array key.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursorAfter
public void positionCursorAfter(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record after the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The values which make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursorAfter
public void positionCursorAfter(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record after the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values which make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursorBefore
public void positionCursorBefore(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record before the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The values which make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
positionCursorBefore
public void positionCursorBefore(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Positions the file cursor to the first record before the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values which make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
read
public Record read(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record with the specified key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
read
public Record read(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record with the specified key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
read
public Record read(java.lang.Object[] key, int searchType) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record meeting the specified search criteria based on key. The searchType indicates that the record whose key first meets the search criteria when compared to key should be returned. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.searchType
- Constant indicating the type of match required. Valid values are:- KEY_EQ
First record whose key is equal to key. - KEY_LT
First record whose key is less than key. - KEY_LE
First record whose key is less than or equal to key. - KEY_GT
First record whose key is greater than key. - KEY_GE
First record whose key is greater than or equal to key.
- KEY_EQ
- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
read
public Record read(byte[] key, int searchType, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record meeting the specified search criteria based on key. The searchType indicates that the record whose key first meets the search criteria when compared to key should be returned. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.searchType
- Constant indicating the type of match required. Valid values are:- KEY_EQ
First record whose key is equal to key. - KEY_LT
First record whose key is less than key. - KEY_LE
First record whose key is less than or equal to key. - KEY_GT
First record whose key is greater than key. - KEY_GE
First record whose key is greater than or equal to key.
- KEY_EQ
numberOfKeyFields
- The number of key fields contained in the byte array key.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readAfter
public Record readAfter(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record after the record with the specified key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readAfter
public Record readAfter(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record after the record with the specified key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readAll
public Record[] readAll() throws AS400Exception, AS400SecurityException, ConnectionDroppedException, java.lang.InterruptedException, java.io.IOException, ServerStartupException, java.net.UnknownHostException
Reads all the records in the file. The file must be closed when invoking this method. The record format for the file must have been set prior to invoking this method.- Specified by:
readAll
in classAS400File
- Returns:
- The records read. If no records are read, an array of size zero is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ServerStartupException
- If the host server cannot be started.java.net.UnknownHostException
- If the system cannot be located.
-
readBefore
public Record readBefore(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record before the record with the specified key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readBefore
public Record readBefore(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the first record before the record with the specified key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readNextEqual
public Record readNextEqual() throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the next record whose key matches the full key of the current record. The file must be open when invoking this method. The file must be positioned on an active record when invoking this method.
Note: If the application has previously called setReadNoUpdate(false), then this method issues a request to the server which locks the record returned to the client. The key comparison occurs on the client side. Therefore, even though the record may not match the key (and null is returned by readNextEqual), the server side will lock the most recent record which may have been read from the file. A subsequent call to any of the positionCursor() methods will unlock the last (i.e. most recent) record locked. In addition, the close() method will also unlock the last (i.e. most recent) record locked.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readNextEqual
public Record readNextEqual(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the next record whose key matches the specified key. The search does not include the current record. The key may be a partial key. The file must be open when invoking this method.
Note: If the application has previously called setReadNoUpdate(false), then this method issues a request to the server which locks the record returned to the client. The key comparison occurs on the client side. Therefore, even though the record may not match the key (and null is returned by readNextEqual), the server side will lock the most recent record which may have been read from the file. A subsequent call to any of the positionCursor() methods will unlock the last (i.e. most recent) record locked. In addition, the close() method will also unlock the last (i.e. most recent) record locked.- Parameters:
key
-- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readNextEqual
public Record readNextEqual(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the next record whose key matches the specified key. The search does not include the current record. The key may be a partial key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.
Note: If the application has previously called setReadNoUpdate(false), then this method issues a request to the server which locks the record returned to the client. The key comparison occurs on the client side. Therefore, even though the record may not match the key (and null is returned by readNextEqual), the server side will lock the most recent record which may have been read from the file. A subsequent call to any of the positionCursor() methods will unlock the last (i.e. most recent) record locked. In addition, the close() method will also unlock the last (i.e. most recent) record locked.numberOfKeyFields
- The number of key fields contained in the byte array key.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readPreviousEqual
public Record readPreviousEqual() throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the previous record whose key matches the key of the current record. The file must be open when invoking this method. The file must be positioned on an active record when invoking this method.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readPreviousEqual
public Record readPreviousEqual(java.lang.Object[] key) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the previous record whose key matches the specified key. The search does not include the current record. The key may be a partial key. The file must be open when invoking this method.- Parameters:
key
-- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
readPreviousEqual
public Record readPreviousEqual(byte[] key, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Reads the previous record whose key matches the specified key. The search does not include the current record. The key may be a partial key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.numberOfKeyFields
- The number of key fields contained in the byte array key.- Returns:
- The record read. If the record is not found, null is returned.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
update
public void update(java.lang.Object[] key, Record record) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Updates the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.record
- The record with which to update the existing record.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
update
public void update(byte[] key, Record record, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Updates the record specified by key. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.record
- The record with which to update the existing record.numberOfKeyFields
- The number of key fields contained in the byte array key.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
update
public void update(java.lang.Object[] key, Record record, int searchType) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Updates the first record meeting the specified search criteria based on key. The searchType indicates that the record whose key first meets the search criteria when compared to key should be returned. The file must be open when invoking this method.- Parameters:
key
- The values that make up the key with which to find the record. The key must contain at least one element. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.record
- The record with which to update the existing record.searchType
- Constant indicating the type of match required. Valid values are:- KEY_EQ
First record whose key is equal to key. - KEY_LT
First record whose key is less than key. - KEY_LE
First record whose key is less than or equal to key. - KEY_GT
First record whose key is greater than key. - KEY_GE
First record whose key is greater than or equal to key.
- KEY_EQ
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
update
public void update(byte[] key, Record record, int searchType, int numberOfKeyFields) throws AS400Exception, AS400SecurityException, java.lang.InterruptedException, java.io.IOException
Updates the first record meeting the specified search criteria based on key. The searchType indicates that the record whose key first meets the search criteria when compared to key should be returned. The file must be open when invoking this method.- Parameters:
key
- The byte array that contains the byte values that make up the key with which to find the record. The byte array key must contain the byte values from at least one key field. The types and order of the elements that make up key must match the type and order of the key fields in the record format for this object. Null values for key fields are not supported.record
- The record with which to update the existing record.searchType
- Constant indicating the type of match required. Valid values are:- KEY_EQ
First record whose key is equal to key. - KEY_LT
First record whose key is less than key. - KEY_LE
First record whose key is less than or equal to key. - KEY_GT
First record whose key is greater than key. - KEY_GE
First record whose key is greater than or equal to key.
- KEY_EQ
numberOfKeyFields
- The number of key fields contained in the byte array key.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped unexpectedly.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
-