All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.access.SequentialFile
java.lang.Object
|
+----com.ibm.as400.access.AS400File
|
+----com.ibm.as400.access.SequentialFile
- public class SequentialFile
- extends AS400File
- implements Serializable
The SequentialFile class represents an AS/400 physical or logical file.
The SequentialFile class allows the user to do the following:
- Create an AS/400 physical file by:
- Specifying a record length.
- Specifying an existing AS/400 DDS source file.
- Specifying a RecordFormat object that contains a description of the
record format for the file.
- Access the records in an AS/400 file sequentially or by record number.
- Write records to an AS/400 file sequentially.
- Update records in an AS/400 file sequentially or by record number.
- Lock an AS/400 file for different types of access.
- Use commitment control when accessing an AS/400 file. The user can:
- Start commitment control for the connection.
- Specify different commitment control lock levels for the individual AS/400
files being accessed.
- Commit and rollback transactions for the connection.
- Delete an AS/400 physical or logical file or member.
SequentialFile objects generate the following events:
-
SequentialFile()
- Constructs a SequentialFile object.
-
SequentialFile(AS400, String)
- Constructs a SequentialFile object.
-
deleteRecord(int)
- Deletes the record specified by record number.
-
positionCursor(int)
- Positions the file cursor to the first record whose record number
matches the specified record number.
-
positionCursorAfter(int)
- Positions the file cursor to the first record after the record specified
by the record number.
-
positionCursorBefore(int)
- Positions the file cursor to the first record before the record specified
by the record number.
-
read(int)
- Reads the record with the specified record number.
-
readAfter(int)
- Reads the first record after the record with the specified record number.
-
readAll()
- Reads all the records in the file.
-
readBefore(int)
- Reads the first record before the record with the specified record number.
-
update(int, Record)
- Updates the record at the position specified by the record number.
SequentialFile
public SequentialFile()
- Constructs a SequentialFile object.
SequentialFile
public SequentialFile(AS400 system,
String name)
- Constructs a SequentialFile object. It uses the
system and file name specified.
If the name for the file does not include a member, the
first member of the file will be used.
- Parameters:
- system - The AS/400 system to which to connect. The system cannot
be null.
- name - The integrated file system pathname of the file. The name
cannot be null.
deleteRecord
public void deleteRecord(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Deletes the record specified by record number. The file must be open when
invoking this method.
- Parameters:
- recordNumber - The record number of the record to be deleted.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
positionCursor
public void positionCursor(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Positions the file cursor to the first record whose record number
matches the specified record number. The file must be open when invoking
this method.
- Parameters:
- recordNumber - The record number of the record at which to position the
cursor.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
positionCursorAfter
public void positionCursorAfter(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Positions the file cursor to the first record after the record specified
by the record number. The file must be open when invoking
this method.
- Parameters:
- recordNumber - The record number of the record after which to position the
cursor. The recordNumber must be greater than zero.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
positionCursorBefore
public void positionCursorBefore(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Positions the file cursor to the first record before the record specified
by the record number. The file must be open when invoking
this method.
- Parameters:
- recordNumber - The record number of the record before which to position
the cursor. The recordNumber must be greater than zero.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
read
public Record read(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Reads the record with the specified record number. The file must be open
when invoking this method.
- Parameters:
- recordNumber - The record number of the record to be read. The
recordNumber must be greater than zero.
- Returns:
- The record read. If the record is not found, null is returned.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
readAfter
public Record readAfter(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Reads the first record after the record with the specified record number.
The file must be open when invoking this method.
- Parameters:
- recordNumber - record number of the record prior to the record to be read.
The recordNumber must be greater than zero.
- Returns:
- The record read. If the record is not found, null is returned.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
readAll
public Record[] readAll() throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- 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.
- Returns:
- The records read. If no records are read, an array of size zero is returned.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
- Overrides:
- readAll in class AS400File
readBefore
public Record readBefore(int recordNumber) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Reads the first record before the record with the specified record number.
The file must be open when invoking this method.
- Parameters:
- recordNumber - The record number of the record after the record to be read.
The recordNumber must be greater than zero.
- Returns:
- The record read. If the record is not found, null is returned.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
update
public void update(int recordNumber,
Record record) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
- Updates the record at the position specified by the record number. The file
must be open when invoking this method.
- Parameters:
- recordNumber - The record number of the record to update.
The recordNumber must be greater than zero.
- record - The record with which to update.
- Throws: AS400Exception
- If the AS/400 system returns an error message.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
All Packages Class Hierarchy This Package Previous Next Index