How to show active jobs using AS400 (JT400) client access software?

喜夏-厌秋 提交于 2020-01-15 07:29:21

问题


I want to develop as400 client access software. I want to monitor disk space, cpu usage etc.. And Job list. I got job list. But I want get to active jobs only. Please help me.

This is my job List Code :

try {
    AS400 system = new AS400 ("SERVER","USER", "PASS");
    JobList jobList = new JobList(system);
    Enumeration list = jobList.getJobs();
    while (list.hasMoreElements())  {
         Job  j= (Job) list.nextElement();
         String GCPU = Integer.toString(j.getCPUUsed());
         System.out.println("Name " + j.getName() + " | Job NO : " + j.getNumber() + " | User : " + j.getUser() + " | CPU USED : " + j.getCPUUsed());
      // System.out.println("Date Entered : " + j.getDate() + " | Status : " + j.getStatus() + " | Type : " + j.getType());

    }
} catch (Exception e) {
         System.out.println(e);
}

回答1:


 JobList jobList = new JobList(system);
 jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE);
 jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE);
 jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE);
 Enumeration jobs = jobList.getJobs();

The list of job selection criteria is maintained internally even when this JobList is closed and re-used. To start over with a new set of job selection criteria, call clearJobSelectionCriteria().

See the Javadoc for more details.



来源:https://stackoverflow.com/questions/16151026/how-to-show-active-jobs-using-as400-jt400-client-access-software

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!