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: SequentialFile objects generate the following events:


Constructor Index

 o SequentialFile()
Constructs a SequentialFile object.
 o SequentialFile(AS400, String)
Constructs a SequentialFile object.

Method Index

 o deleteRecord(int)
Deletes the record specified by record number.
 o open(int, int, int)
Opens the file.
 o positionCursor(int)
Positions the file cursor to the first record whose record number matches the specified record number.
 o positionCursorAfter(int)
Positions the file cursor to the first record after the record specified by the record number.
 o positionCursorBefore(int)
Positions the file cursor to the first record before the record specified by the record number.
 o read(int)
Reads the record with the specified record number.
 o readAfter(int)
Reads the first record after the record with the specified record number.
 o readAll()
Reads all the records in the file.
 o readBefore(int)
Reads the first record before the record with the specified record number.
 o update(int, Record)
Updates the record at the position specified by the record number.

Constructors

 o SequentialFile
 public SequentialFile()
Constructs a SequentialFile object.

 o 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.

Methods

 o 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.
 o open
 public void open(int openType,
                  int blockingFactor,
                  int commitLockLevel) throws AS400Exception, AS400SecurityException, InterruptedException, IOException
Opens the file. The file must not be open when invoking this method. If commitment control is not started for the connection, commitLockLevel is ignored. The file cursor is positioned prior to the first record. If blockingFactor is greater than one (or if zero is specified and a blocking factor greater than one is determined by the object) and the file is opened for READ_ONLY, the record cache will be filled with an initial set of records.
The record format for the file must be set prior to calling this method.
The name of the file and the AS400 system to which to connect must be set prior to invoking this method.

Parameters:
openType - The manner in which to open the file. Valid values are:
  • READ_ONLY
  • READ_WRITE
  • WRITE_ONLY
blockingFactor - The number of records to retrieve or to write during a read or write operation.
The AS400File object will attempt to anticipate the need for data by accessing blocks of records if the openType is READ_ONLY. If the openType is WRITE_ONLY, blockingFactor number of records will be written at one time when writing an array of records. If the open type is READ_WRITE, blockingFactor is ignored and a blocking factor of 1 will be used for data integrity reasons. Specify an appropriate blockingFactor for your performance needs.
If 0 is specified for blockingFactor, a default value will be calculated by taking the integer result of dividing 2048 by the byte length of the record plus 16.
If the user either specifies a blocking factor greater than 1 or specifies 0, which will cause a blocking factor to be calculated, there is the risk of obtaining stale data when doing multiple read operations. Invoke the refreshRecordCache() method prior to reading a record to cause the object to read from the AS/400 if this is a problem.
commitLockLevel - Used to control record locking during a transaction if commitment control has been started for the connection. Valid values are:
  • COMMIT_LOCK_LEVEL_ALL
  • COMMIT_LOCK_LEVEL_CHANGE
  • COMMIT_LOCK_LEVEL_CURSOR_STABILITY
  • COMMIT_LOCK_LEVEL_DEFAULT
  • COMMIT_LOCK_LEVEL_NONE
The commitLockLevel is ignored if commitment control is not started for the connection.
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:
open in class AS400File
See Also:
AS400File, setPath, setSystem, refreshRecordCache, setRecordFormat
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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
 o 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.
 o 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