|
I note that the Toolbox has a FileListener interface, and the AS400File
class has an AddFileListener method.
I tried implementing the interface from my test class, and while I then
received a "FileOpened" event as soon as the test class opened the file,
that was about all I got. I was hoping to receive a "FileModified" event
when I updated a record from QuestView in another terminal session, but it
didn't get ANY events from actions taken elsewhere.
Am I doing something wrong, or do I just have unrealistically high
expectations?
The test class now looks like:
import com.ibm.as400.access.*;
class test03 implements FileListener {
public static void main (String args[]) {
System.out.println("I like spam!");
AS400 as400 = new AS400("localhost");
System.out.println("CCSID = " + as400.getCcsid());
QSYSObjectPathName fileName = new
QSYSObjectPathName("AQUESTVIEW", "VIEWCUS", "FILE");
System.out.println("Filename = " + fileName.getPath());
SequentialFile file = new SequentialFile(as400, fileName.getPath());
file.addFileListener(new test03());
AS400FileRecordDescription recDes = new
AS400FileRecordDescription(as400, fileName.getPath());
try {
RecordFormat recFmt = recDes.retrieveRecordFormat()[0];
System.out.println("Format = " + recFmt.getName());
file.setRecordFormat(recFmt);
file.open(SequentialFile.READ_ONLY, 1,
SequentialFile.COMMIT_LOCK_LEVEL_NONE);
Record data = file.readNext();
while (data != null) {
System.out.println((String) data.getField("CUNAME"));
data = file.readNext();
}
System.out.println("Going to sleep");
try {Thread.sleep((long)60000);} catch(InterruptedException
ie) {System.out.println("Interrupted");}
System.out.println("Waking up!");
as400.disconnectAllServices();
} catch (Exception e) {e.printStackTrace();}
}
--
JHHL
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.