Search code examples
javaibm-midrangejt400job-queue

AS400 JOB Queue via Java jt400


I am just writing an Interface between a java application and an AS400. For this purpose I use jt400. I managed to get information about the systemstatus like CPU usage, as well I managed to receive the current status about subsystems and jobs.

Now I am searching for an option to have a look at the different job queues inside the AS400.

For example: I would like to know, how many jobs are in which queue.

Is there a solution via jt400 or a different approach to access those information via java?

The corresponding command inside AS400 is WRKJOBQ

Best LStrike

[Edit]

The following code is my filter for JobList. But how do I configure QSYSObjectPathName that it is matching WRKJOBQ?

QSYSObjectPathName path = new QSYSObjectPathName(.....);

JobList jList = new JobList(as400);
jList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, true); 
jList.addJobSelectionCriteria(JobList.SELECTION_JOB_QUEUE, path.getPath());
Job[] jobs = jList.getJobs(-1, 1);
System.out.println("Jobs Size: " + jobs.length);

Solution

  • You can use a JobList object for that, using SELECTION_JOB_QUEUE to filter jobs.

    Once your selection suits your need, JobList#getLength() will give you the number of jobs.

    See also this question