com.ibm.as400.access
Class SequentialFile

java.lang.Object
  extended by com.ibm.as400.access.AS400File
      extended by com.ibm.as400.access.SequentialFile
All Implemented Interfaces:
Serializable

public class SequentialFile
extends AS400File
implements Serializable

The SequentialFile class represents a physical or logical file on the system. The SequentialFile class allows the user to do the following:

SequentialFile objects generate the following events:

See Also:
MemberList, Serialized Form

Field Summary
Modifier and Type Field and Description
 
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, 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
Constructor and Description
SequentialFile()
          Constructs a SequentialFile object.
SequentialFile(AS400 system, String name)
          Constructs a SequentialFile object.
 
Method Summary
Modifier and Type Method and Description
 void deleteRecord(int recordNumber)
          Deletes the record specified by record number.
 void positionCursor(int recordNumber)
          Positions the file cursor to the first record whose record number matches the specified record number.
 void positionCursorAfter(int recordNumber)
          Positions the file cursor to the first record after the record specified by the record number.
 void positionCursorBefore(int recordNumber)
          Positions the file cursor to the first record before the record specified by the record number.
 Record read(int recordNumber)
          Reads the record with the specified record number.
 Record readAfter(int recordNumber)
          Reads the first record after the record with the specified record number.
 Record[] readAll()
          Reads all the records in the file.
 Record readBefore(int recordNumber)
          Reads the first record before the record with the specified record number.
 void update(int recordNumber, Record record)
          Updates the record at the position specified by the record number.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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.

Specified by:
readAll in class AS400File
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.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ServerStartupException - If the host server cannot be started.
UnknownHostException - If the system cannot be located.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.

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 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.