TheJobLog class (in the access package) retrieves messages in the job log of a server 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 server
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());
}
}
}