0

I want to get IBM i job details using that job number. i get all job list. but i want to get job details using it's job no. Please help me friends.

Edit: I believe the question is 'How can I get job details given a fully qualified job name?'

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());

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

1 回答 1

3

你可以用不同的方式来做。您可以要求 JT400 返回您正在寻找的特定工作,或者您可以要求 JT400 对工作列表进行子集化。以下是两者的示例:

    public static void main(String[] args) {

    String systemName = "my_system_name";
    String jobName = "job_name";
    String userName = "user_name";
    String jobNumber = "job_number";

try {
    AS400 system = new AS400 (systemName);

    // Get this specific job
    Job job = new Job(system, jobName, userName, jobNumber);
    System.out.println("Name " + job.getName() + " | Job NO : " + job.getNumber() + " | User : " + job.getUser() + " | CPU USED : " + job.getCPUUsed());

    // Create a list and subset it
    JobList jobList = new JobList(system);
    jobList.clearJobSelectionCriteria();
    jobList.addJobSelectionCriteria(JobList.SELECTION_JOB_NUMBER, jobNumber);
    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());
        }

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

}
于 2013-05-03T14:10:40.413 回答