JobLog class

The JobLog class (in the access package) retrieves messages in the job log of a server job by calling getMessages().

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.

Example: Using JobLog

The following example prints all messages in the job log for the specified user:

                       // ... Setup work to create an AS400
                       // object and a jobList object has
                       // already been done

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

                       // Look through the list to find a
                       // job for the specified user.
     while (list.hasMoreElements())
     {
        Job j = (Job) list.nextElement();

        if (j.getUser().trim().equalsIgnoreCase(userID))
        {
                       // A job matching the current user
                       // was found. Create a job log
                       // object for this job.
           JobLog jlog = new JobLog(system, j.getName(), j.getUser(), j.getNumber());

                       // Enumerate the messages in the job
                       // log then print them.
           Enumeration messageList = jlog.getMessages();

           while (messageList.hasMoreElements())
           {
               AS400Message message = (AS400Message) messageList.nextElement();
               System.out.println(message.getText());
           }

        }
     }