Jobs

The AS/400 Toolbox for Java Jobs classes (in the access package) allow a Java program to retrieve and change job information.

Begin changeNote: When possible, use a resource class instead a class from the access package. Resource classes provide a generic framework and a consistent programming interface for working with various AS/400 objects and lists. The resource classes for working with jobs are RJob, RJobList, and RJobLog.End change

Use the Jobs classes to work with the following type of job information:

The job classes in the access package are as follows:

Examples

List the jobs belonging to a specific user and list jobs with job status information.

Display the messages in a job log.

Use a cache when setting a value and getting a value:

  try {
      // Creates AS400 object.
      AS400 as400 = new AS400("systemName");
      // Constructs a Job object
      Job job = new Job(as400,"QDEV002");
      // Gets job information
      System.out.println("User of this job :" + job.getUser());
      System.out.println("CPU used :" + job.getCPUUsed();
      System.out.println("Job enter system date : " + job.getJobEnterSystemDate());
      // Sets cache mode
      job.setCacheChanges(true);
      // Changes will be store in the cache.
      job.setRunPriority(66);
      job.setDateFormat("*YMD");
      // Commit changes. This will change the value on the AS/400.
      job.commitChanges();
      // Set job information to system directly(without cache).
      job.setCacheChanges(false);
      job.setRunPriority(60);
  } catch (Exception e)
  {
      System.out.println(quot;error :" + e)
  }