com.ibm.as400.access
Class JobLog

java.lang.Object
  |
  +--com.ibm.as400.access.JobLog
All Implemented Interfaces:
java.io.Serializable

public class JobLog
extends java.lang.Object
implements java.io.Serializable

The JobLog class represents an AS/400 job log. This is used to get a list of messages in a job log or to write messages to a job log.

The complete set of selections for a job log can be accessed using the RJobLog class.

QueuedMessage objects have many attributes. Only some of theses attribute values are set, depending on how a QueuedMessage object is created. The following is a list of attributes whose values are set on QueuedMessage objects returned in a list of job log messages:

See Also:
RJobLog, Serialized Form

Constructor Summary
JobLog()
          Constructs a JobLog object.
JobLog(AS400 system)
          Constructs a JobLog object.
JobLog(AS400 system, java.lang.String name, java.lang.String user, java.lang.String number)
          Constructs a JobLog object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds a VetoableChangeListener.
 int getLength()
          Returns the number of messages in the job log.
 java.util.Enumeration getMessages()
          Returns the list of messages in the job log.
 java.lang.String getName()
          Returns the job name.
 java.lang.String getNumber()
          Returns the job number.
 AS400 getSystem()
          Returns the system.
 java.lang.String getUser()
          Returns the user name.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Removes a VetoableChangeListener.
 void setName(java.lang.String name)
          Sets the job name.
 void setNumber(java.lang.String number)
          Sets the job number.
 void setSystem(AS400 system)
          Sets the system.
 void setUser(java.lang.String user)
          Sets the user name.
static void writeMessage(AS400 system, java.lang.String messageID, int messageType)
          Writes a program message to the job log for the job in which the program is running.
static void writeMessage(AS400 system, java.lang.String messageID, int messageType, byte[] substitutionData)
          Writes a program message to the job log for the job in which the program is running.
static void writeMessage(AS400 system, java.lang.String messageID, int messageType, java.lang.String messageFile)
          Writes a program message to the job log for the job in which the program is running.
static void writeMessage(AS400 system, java.lang.String messageID, int messageType, java.lang.String messageFile, byte[] substitutionData)
          Writes a program message to the job log for the job in which the program is running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobLog

public JobLog()
Constructs a JobLog object.

JobLog

public JobLog(AS400 system)
Constructs a JobLog object.
Parameters:
system - The system.

JobLog

public JobLog(AS400 system,
              java.lang.String name,
              java.lang.String user,
              java.lang.String number)
Constructs a JobLog object.
Parameters:
system - The system.
name - The job name.
user - The user name.
number - The job number.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed.
Parameters:
listener - The listener.

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed.
Parameters:
listener - The listener.

getLength

public int getLength()
Returns the number of messages in the job log.
Returns:
The number of messages, or 0 if no list has been retrieved.

getMessages

public java.util.Enumeration getMessages()
                                  throws AS400Exception,
                                         AS400SecurityException,
                                         ErrorCompletingRequestException,
                                         java.lang.InterruptedException,
                                         java.io.IOException,
                                         ObjectDoesNotExistException
Returns the list of messages in the job log. The messages are listed from oldest to newest.
Returns:
An Enumeration of QueuedMessage objects.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.lang.InterruptedException - If this thread is interrupted.
java.io.IOException - If an error occurs while communicating with the AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.
ServerStartupException - If the AS/400 server cannot be started.
java.net.UnknownHostException - If the AS/400 system cannot be located.

getName

public java.lang.String getName()
Returns the job name.
Returns:
The job name, or "" if none has been set.

getNumber

public java.lang.String getNumber()
Returns the job number.
Returns:
The job number, or "" if none has been set.

getSystem

public AS400 getSystem()
Returns the system.
Returns:
The system.

getUser

public java.lang.String getUser()
Returns the user name.
Returns:
The user name, or "" if none has been set.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.
Parameters:
listener - The listener.

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a VetoableChangeListener.
Parameters:
listener - The listener.

setName

public void setName(java.lang.String name)
             throws java.beans.PropertyVetoException
Sets the job name. This cannot be changed if the object has established a connection to the AS/400.
Parameters:
name - The job name.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

setNumber

public void setNumber(java.lang.String number)
               throws java.beans.PropertyVetoException
Sets the job number. This cannot be changed if the object has established a connection to the AS/400.
Parameters:
number - The job number.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

setSystem

public void setSystem(AS400 system)
               throws java.beans.PropertyVetoException
Sets the system. This cannot be changed if the object has established a connection to the AS/400.
Parameters:
system - The system.
Throws:
java.beans.PropertyVetoException - If the property change is vetoed.

setUser

public void setUser(java.lang.String user)
             throws java.beans.PropertyVetoException
Sets the user name. This cannot be changed if the object has established a connection to the AS/400.
Parameters:
user - The user name.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

writeMessage

public static void writeMessage(AS400 system,
                                java.lang.String messageID,
                                int messageType)
                         throws AS400SecurityException,
                                ErrorCompletingRequestException,
                                java.lang.InterruptedException,
                                java.io.IOException,
                                ObjectDoesNotExistException,
                                AS400Exception
Writes a program message to the job log for the job in which the program is running.
Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the iSeries server.
Parameters:
system - The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.
messageID - The message ID. The message must be in the default message file /QSYS.LIB/QCPFMSG.MSGF.
messageType - The message type. Possible values are:
  • AS400Message.COMPLETION
  • AS400Message.DIAGNOSTIC
  • AS400Message.INFORMATIONAL
  • AS400Message.ESCAPE
The message type must be AS400Message.INFORMATIONAL for an immediate message.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.lang.InterruptedException - If this thread is interrupted.
java.io.IOException - If an error occurs while communicating with the AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.
ServerStartupException - If the AS/400 server cannot be started.
java.net.UnknownHostException - If the AS/400 system cannot be located.
See Also:
ProgramCall.isStayOnThread()

writeMessage

public static void writeMessage(AS400 system,
                                java.lang.String messageID,
                                int messageType,
                                byte[] substitutionData)
                         throws AS400SecurityException,
                                ErrorCompletingRequestException,
                                java.lang.InterruptedException,
                                java.io.IOException,
                                ObjectDoesNotExistException,
                                AS400Exception
Writes a program message to the job log for the job in which the program is running.
Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the iSeries server.
Parameters:
system - The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.
messageID - The message ID. The message must be in the default message file /QSYS.LIB/QCPFMSG.MSGF.
messageType - The message type. Possible values are:
  • AS400Message.COMPLETION
  • AS400Message.DIAGNOSTIC
  • AS400Message.INFORMATIONAL
  • AS400Message.ESCAPE
The message type must be AS400Message.INFORMATIONAL for an immediate message.
substitutionData - The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.lang.InterruptedException - If this thread is interrupted.
java.io.IOException - If an error occurs while communicating with the AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.
ServerStartupException - If the AS/400 server cannot be started.
java.net.UnknownHostException - If the AS/400 system cannot be located.
See Also:
ProgramCall.isStayOnThread()

writeMessage

public static void writeMessage(AS400 system,
                                java.lang.String messageID,
                                int messageType,
                                java.lang.String messageFile)
                         throws AS400SecurityException,
                                ErrorCompletingRequestException,
                                java.lang.InterruptedException,
                                java.io.IOException,
                                ObjectDoesNotExistException,
                                AS400Exception
Writes a program message to the job log for the job in which the program is running.
Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the iSeries server.
Parameters:
system - The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.
messageID - The message ID.
messageType - The message type. Possible values are:
  • AS400Message.COMPLETION
  • AS400Message.DIAGNOSTIC
  • AS400Message.INFORMATIONAL
  • AS400Message.ESCAPE
The message type must be AS400Message.INFORMATIONAL for an immediate message.
messageFile - The integrated file system path name of the message file.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.lang.InterruptedException - If this thread is interrupted.
java.io.IOException - If an error occurs while communicating with the AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.
ServerStartupException - If the AS/400 server cannot be started.
java.net.UnknownHostException - If the AS/400 system cannot be located.
See Also:
ProgramCall.isStayOnThread()

writeMessage

public static void writeMessage(AS400 system,
                                java.lang.String messageID,
                                int messageType,
                                java.lang.String messageFile,
                                byte[] substitutionData)
                         throws AS400SecurityException,
                                ErrorCompletingRequestException,
                                java.lang.InterruptedException,
                                java.io.IOException,
                                ObjectDoesNotExistException,
                                AS400Exception
Writes a program message to the job log for the job in which the program is running.
Note: The program runs in the job of the Remote Command Host Server (QZRCSRVS) unless it is invoked "on-thread" on the iSeries server.
Parameters:
system - The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.
messageID - The message ID.
messageType - The message type. Possible values are:
  • AS400Message.COMPLETION
  • AS400Message.DIAGNOSTIC
  • AS400Message.INFORMATIONAL
  • AS400Message.ESCAPE
The message type must be AS400Message.INFORMATIONAL for an immediate message.
messageFile - The integrated file system path name of the message file.
substitutionData - The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.lang.InterruptedException - If this thread is interrupted.
java.io.IOException - If an error occurs while communicating with the AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.
ServerStartupException - If the AS/400 server cannot be started.
java.net.UnknownHostException - If the AS/400 system cannot be located.
See Also:
ProgramCall.isStayOnThread()