First of all, I would like to apologize if i am not in the correct forum. Please kindly inform me if i did so.
I am trying to read some data from a data area in AS400 by using the jt400.jar provided by IBM.
I have successfully retrieve the data and printed it out into a file. But, my application didn't stop and still running. I have to manually stop/kill the process.
Below is the code snippet:
import java.sql.*;
import com.ibm.as400.access.*;
public class AreaData implements Runnable {
private static LogWriter log;
private AS400 system;
private QSYSObjectPathName path;
private CharacterDataArea charDataArea;
public AreaData () {
super();
try {
log = new LogWriter("AreaData.log");
} catch (Exception e) {
System.out.println("Log create failed.");
System.out.println(e.getMessage());
}
}
public static void main (String[] arg) {
try {
AreaData da = new AreaData();
Thread thread = new Thread(da);
thread.start();
} catch(Exception e) {
log.write("Thread run failed : " + e.getMessage());
}
}
public void run() {
try {
system = new AS400("SystemName", "userid", "password");
path = new QSYSObjectPathName("library", "object", "DTAARA");
charDataArea = new CharacterDataArea(system, path.getPath());
String text = charDataArea.read();
log.write(text);
} catch (Exception dataAreaExp) {
log.write("Data Area : " + dataAreaExp.getMessage());
}
}
Any reply is appreciated and thanks in advanced.