AS/400 Toolbox for Java \ Access classes \ Jobs \ Job log

JobLog

The JobLog class retrieves messages in the job log of an AS/400 job by calling getMessages().

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 AS/400
     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());
           }

        }
     }

[ Information Center Home Page | Feedback ] [ Legal | AS/400 Glossary ]