JobList class

You can use JobList class (in the access package) to list iSeries™ jobs.

Note: IBM® Toolbox for Java™ also provides resource classes that present a generic framework and consistent programming interface for working with various iSeries objects and lists. After reading about the classes in the access package and the resource package, you can choose the object that works best for your application. The resource classes for working with jobs are RJob, RJobList, and RJobLog.

With the JobList class, you can retrieve the following:

Use the getJobs() method to return a list of iSeries jobs or getLength() method to return the number of jobs retrieved with the last getJobs().

Example: Using JobList

The following example lists all active jobs on the system:

                       // Create an AS400 object. List the
                       // jobs on this iSeries.
     AS400 sys = new AS400("mySystem.myCompany.com");

                       // Create the job list object.
     JobList jobList = new JobList(sys);

                       // Get the list of active jobs.
     Enumeration list = jobList.getJobs();

                       // For each active job on the system
                       // print job information.
     while (list.hasMoreElements())
     {
         Job j = (Job) list.nextElement();

         System.out.println(j.getName() + "." +
                            j.getUser() + "." +
                            j.getNumber());
     }