Jobs classes

The IBM® Toolbox for Java™ Jobs classes, which are in the access package, allow a Java program to retrieve and change job information.

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

Examples

The following examples show some of the ways you can use the Job, JobList, and JobLog classes. The first example shows one way to use a cache with the Job class. Links to other examples immediately follow the sample code.
Note: Read the Code example disclaimer for important legal information.

Example: Using a cache when setting a value and getting a value

  try {

      // Creates AS400 object.
      AS400 as400 = new AS400("systemName");

      // Constructs a Job object
      byte[] internalJobID = "xxxxxxxxxxxxxxxx".getBytes();
      Job job = new Job(as400, internalJobID);

      // 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 system.
      job.commitChanges();

      // Set job information to system directly(without cache).
      job.setCacheChanges(false);
      job.setRunPriority(60);
  } catch (Exception e)
  {
      System.out.println("error :" + e);
  }

The following examples show how to list the jobs belonging to a specific user, list jobs with the job status information, and display the messages in a job log:

Example: Using JobList to list job identification information

Example: Using JobList to get a list of jobs

Example: Using JobLog to display messages in the job log