com.ibm.as400.access

Class JobDescription

  • java.lang.Object
    • com.ibm.as400.access.JobDescription
  • All Implemented Interfaces:
    java.io.Serializable


    public class JobDescription
    extends java.lang.Object
    implements java.io.Serializable
    Represents an IBM i job description.

    Note that calling any of the attribute getters for the first time will result in an implicit call to refresh(). If any exception is thrown by an implicit call to refresh(), it will be logged to Trace.ERROR and rethrown as a java.lang.RuntimeException. However, should an exception occur during an explicit call to refresh(), the exception will be thrown as-is to the caller.

    Implementation note: This class internally calls the Retrieve Job Description (QWDRJOBD) API.

    This class was inspired by a prototype submitted by Kendall Coolidge.

    See Also:
    Serialized Form
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      boolean exists()
      Determines if the Job Description currently exists on the system.
      java.lang.String getAccountingCode()
      Returns the accounting code associated with this job description.
      java.lang.String getCYMDJobDate()
      Returns the job date in CYMD format.
      java.lang.String getDDMConversation()
      Returns whether Distributed Data Management conversations are kept or dropped when they are not being used.
      java.lang.String getDeviceRecoveryAction()
      Returns the action to take when an I/O error occurs for the interactive job's requesting program device.
      int getEndSeverity()
      Returns the message severity level of escape messages that can cause a batch job to end.
      java.lang.String[] getInitialASPGroupNames()
      Returns the list of initial ASP groups for jobs that use this job description.
      java.lang.String[] getInitialLibraryList()
      Returns the initial library list that is used for jobs that use this job description.
      java.lang.String getInquiryMessageReply()
      Indicates how inquiry messages are answered for jobs that use this job description.
      java.lang.String getJobDateString()
      Returns the date that will be assigned to jobs using this job description when they are started.
      java.lang.String getJobLogOutput()
      Indicates how the job log will be produced when the job completes.
      java.lang.String getJobMessageQueueFullAction()
      Returns the action to be taken when the job message queue becomes full.
      int getJobMessageQueueMaximumSize()
      Returns the maximum size (in megabytes) of the job message queue.
      java.lang.String getJobQueueLibraryName()
      Returns the library of the job queue into which batch jobs using this job description are placed.
      java.lang.String getJobQueueName()
      Returns the name of the job queue into which batch jobs using this job description are placed.
      int getJobQueuePriority()
      Returns the scheduling priority of each job that uses this job description.
      byte getJobSwitches()
      Returns the initial settings for a group of eight job switches used by jobs that use this job description.
      java.lang.String getLibraryName()
      Returns name of the library in which the job description resides.
      int getMessageLoggingLevel()
      Returns the type of information logged.
      int getMessageLoggingSeverity()
      Returns the severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log.
      java.lang.String getMessageLoggingText()
      Returns the level of message text that is written in the job log when a message is logged according to the logging level and logging severity.
      java.lang.String getName()
      Returns name of the job description about which information is being returned.
      ObjectDescription getObjectDescription()
      Returns an ObjectDescription instance representing the job description.
      java.lang.String getOutputQueueLibraryName()
      Returns the name of the library in which the output queue resides.
      java.lang.String getOutputQueueName()
      Returns the name of the default output queue that is used for spooled output produced by jobs that use this job description.
      int getOutputQueuePriority()
      Returns the output priority for spooled files that are produced by jobs using this job description.
      java.lang.String getPrinterDeviceName()
      Returns the name of the printer device or the source for the name of the printer device that is used for all spooled files created by jobs that use this job description.
      java.lang.String getPrintText()
      Returns the line of text (if any) that is printed at the bottom of each page of printed output for jobs using this job description.
      java.lang.String getRoutingData()
      Returns the routing data that is used with this job description to start jobs.
      java.lang.String getSpooledFileAction()
      Returns the value that specifies whether spooled files can be accessed through job interfaces once a job has completed its normal activity.
      int getSyntaxCheckSeverity()
      Returns whether requests placed on the job's message queue are checked for syntax as CL commands, and the message severity that causes a syntax error to end processing of a job.
      AS400 getSystem()
      Returns the system where the job description is located.
      java.lang.String getTextDescription()
      Returns the user text, if any, used to briefly describe the job description.
      java.lang.String getTimeSliceEndPool()
      Returns whether interactive jobs using this job description should be moved to another main storage pool when they reach time-slice end.
      java.lang.String getUserName()
      Returns the name of the user profile associated with this job description.
      boolean isAllowMultipleThreads()
      Returns whether or not the job is allowed to run with multiple user threads.
      boolean isHoldOnJobQueue()
      Returns whether jobs using this job description are put on the job queue in the hold condition.
      boolean isLoggingOfCLPrograms()
      Returns whether or not commands are logged for CL programs that are run.
      void refresh()
      Refreshes the values for all attributes of the job description.
      void setLibraryName(java.lang.String library)
      Sets the library where the job description is located.
      void setName(java.lang.String name)
      Sets the job description name.
      void setSystem(AS400 system)
      Sets the system.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JobDescription

        public JobDescription(AS400 system,
                      java.lang.String library,
                      java.lang.String name)
        Constructs a JobDescription.
        Parameters:
        system - The system where the job description resides.
        name - The name of the job description to retrieve.
        library - The library containing the job description.
      • JobDescription

        public JobDescription(AS400 system,
                      QSYSObjectPathName path)
        Constructs a JobDescription.
        Parameters:
        system - The system where the job description resides.
        path - The fully qualified IFS path to the job description.
    >
    • Method Detail

      • getAccountingCode

        public java.lang.String getAccountingCode()
        Returns the accounting code associated with this job description.

        An identifier assigned to jobs that use this job description. This code is used to collect system resource use information. If the special value *USRPRF is specified, the accounting code used for jobs using this job description is obtained from the job's user profile.

        Returns:
        The accounting code.
      • isAllowMultipleThreads

        public boolean isAllowMultipleThreads()
        Returns whether or not the job is allowed to run with multiple user threads.

        This attribute does not prevent the operating system from creating system threads in the job. This attribute is not allowed to be changed once a job starts. This attribute applies to autostart jobs, prestart jobs, batch jobs submitted from job schedule entries, and jobs started by using the Submit Job (SBMJOB) and Batch Job (BCHJOB) commands. This attribute is ignored when starting all other types of jobs. This attribute should be set to true only in job descriptions that are used exclusively with functions that create multiple user threads.

        Returns:
        Whether or not the job is allowed to run with multiple user threads. Possible values are:
        • true - Multiple threads allowed.
        • false - Multiple user threads not allowed.
      • getCYMDJobDate

        public java.lang.String getCYMDJobDate()
        Returns the job date in CYMD format.

        The date that will be assigned to jobs using this job description when they are started. The possible values are:

        • "*SYSVAL" - The value in the QDATE system value is used at the time the job is started.
        • job-date - The date to be used at the time the job is started. The format of the field returned in CYYMMDD where C is the century, YY is the year, MM is the month, and DD is the day. A 0 for the century indicates years 19xx and a 1 indicates years 20xx. The field is padded on the right with blanks.
        Returns:
        The job date in CYYMMDD format.
      • getDeviceRecoveryAction

        public java.lang.String getDeviceRecoveryAction()
        Returns the action to take when an I/O error occurs for the interactive job's requesting program device. The possible values are:
        • "*SYSVAL" - The value in the system value QDEVRCYACN at the time the job is started is used as the device recovery action for this job description.
        • "*DSCMSG" - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends a message to the application program, indicating the job has reconnected and that the workstation device has recovered.
        • "*DSCENDRQS" - Disconnects the job when an I/O error occurs. When the job reconnects, the system sends the End Request (ENDRQS) command to return control to the previous request level.
        • "*ENDJOB" - Ends the job when an I/O error occurs. A message is sent to the job's log and to the history log (QHST). This message indicates that the job ended because of a device error.
        • "*ENDJOBNOLIST" - Ends the job when an I/O error occurs. There is no job log produced for the job. The system sends a message to the history log (QHST). This message indicates that the job ended because of a device error.
        Returns:
        The device recovery action.
      • getDDMConversation

        public java.lang.String getDDMConversation()
        Returns whether Distributed Data Management conversations are kept or dropped when they are not being used. The possible values are:
        • *KEEP - The system keeps DDM conversation connections active when there are no users.
        • *DROP - The system ends a DDM-allocated conversation when there are no users.
        • null if system is pre-V5R3.
        Returns:
        Whether DDM conversations are kept or dropped.
      • getEndSeverity

        public int getEndSeverity()
        Returns the message severity level of escape messages that can cause a batch job to end. The possible values are from 0 through 99.
        Returns:
        The message severity level of escape messages that can cause a batch job to end.
      • isHoldOnJobQueue

        public boolean isHoldOnJobQueue()
        Returns whether jobs using this job description are put on the job queue in the hold condition.
        Returns:
        Whether jobs using this job description are put on the job queue in the hold condition.
      • getInitialLibraryList

        public java.lang.String[] getInitialLibraryList()
        Returns the initial library list that is used for jobs that use this job description. Only the libraries in the user portion of the library list are included.
        Returns:
        The initial library list as an array of type String
      • getInquiryMessageReply

        public java.lang.String getInquiryMessageReply()
        Indicates how inquiry messages are answered for jobs that use this job description. The possible values are:
        • "*RQD" - The job requires an answer for any inquiry messages that occur while the job is running.
        • "*DFT" - The system uses the default message reply to answer any inquiry messages issued while the job is running. The default reply is either defined in the message description or is the default system reply.
        • "*SYSRPYL" - The system reply list is checked to see if there is an entry for an inquiry message issued while the job is running. If a match occurs, the system uses the reply value for that entry. If no entry exists for that message, the system uses an inquiry message.
        Returns:
        The inquiry message reply behavior.
      • getInitialASPGroupNames

        public java.lang.String[] getInitialASPGroupNames()
        Returns the list of initial ASP groups for jobs that use this job description. This does not include the system ASP or basic user ASPs. null if system is pre-V5R2.
        Returns:
        The list of initial ASP groups. null if system is pre-V5R2.
      • getJobDateString

        public java.lang.String getJobDateString()
        Returns the date that will be assigned to jobs using this job description when they are started. The possible values are:
        • "*SYSVAL" - The value in the QDATE system value is used at the time the job is started.
        • job-date - The date to be used at the time the job is started. This date is in the format specified for the DATFMT job attribute.
        Returns:
        The date that will be assigned to jobs using this job description.
      • getLibraryName

        public java.lang.String getLibraryName()
        Returns name of the library in which the job description resides.
        Returns:
        The name of the library in which the job description resides.
      • getName

        public java.lang.String getName()
        Returns name of the job description about which information is being returned.
        Returns:
        The name of the job description about which information is being returned.
      • getJobLogOutput

        public java.lang.String getJobLogOutput()
        Indicates how the job log will be produced when the job completes. The possible values are:
        • *SYSVAL - The value is specified by the QLOGOUTPUT system value.
        • *JOBLOGSVR - The job log will be produced by a job log server. For more information about job log servers, refer to the Start Job Log Server (STRLOGSVR) command.
        • *JOBEND - The job log will be produced by the job itself. If the job cannot produce its own job log, the job log will be produced by a job log server. For example, a job does not produce its own job log when the system is processing a Power Down System (PWRDWNSYS) command.
        • *PND - The job log will not be produced. The job log remains pending until removed.
        • null if system is pre-V5R4.
        Returns:
        The job log output behavior.
      • getJobMessageQueueFullAction

        public java.lang.String getJobMessageQueueFullAction()
        Returns the action to be taken when the job message queue becomes full.
        The possible values are:
        • "*SYSVAL" - The value is specified by the system value QJOBMSGQFL.
        • "*NOWRAP" - When the message queue becomes full, do not wrap. This action will cause the job to end.
        • "*WRAP" - When the message queue becomes full, wrap to the beginning and start filling again.
        • "*PRTWRAP" - When the message queue becomes full, wrap the job queue and print the messages that are being overlaid.
        Returns:
        The action to be taken when the job message queue becomes full.
      • getJobMessageQueueMaximumSize

        public int getJobMessageQueueMaximumSize()
        Returns the maximum size (in megabytes) of the job message queue.
        The possible values are:
        • 0 - The maximum size set by system value QJOBMSGMX at the time the job is started.
        • 2-64 - The maximum size of the job message queue in megabytes.
        Returns:
        The maximum size (in megabytes) of the job message queue.
      • getJobQueueLibraryName

        public java.lang.String getJobQueueLibraryName()
        Returns the library of the job queue into which batch jobs using this job description are placed.
        Returns:
        The library of the job queue into which batch jobs using this job description are placed.
      • getJobQueueName

        public java.lang.String getJobQueueName()
        Returns the name of the job queue into which batch jobs using this job description are placed.
        Returns:
        The name of the job queue into which batch jobs using this job description are placed.
      • getJobQueuePriority

        public int getJobQueuePriority()
        Returns the scheduling priority of each job that uses this job description.
        The highest priority is 1 and the lowest priority is 9.
        Returns:
        The scheduling priority of each job that uses this job description.
      • getJobSwitches

        public byte getJobSwitches()
        Returns the initial settings for a group of eight job switches used by jobs that use this job description. These switches can be set or tested in a program and used to control a program's flow.
        For each bit position, the possible values are '0' (off) and '1' (on).
        Returns:
        A bit-map containing the initial settings for the eight job switches.
      • isLoggingOfCLPrograms

        public boolean isLoggingOfCLPrograms()
        Returns whether or not commands are logged for CL programs that are run.
        Returns:
        Whether or not commands are logged for CL programs that are run.
      • getMessageLoggingLevel

        public int getMessageLoggingLevel()
        Returns the type of information logged. Possible types are:
        • 0 - No messages are logged.
        • 1 - All messages sent to the job's external message queue with a severity greater than or equal to the message logging severity are logged. This includes the indication of job start, job end and job completion status.
        • 2 - The following information is logged:
          • Level 1 information.
          • Request messages that result in a high-level message with a severity code greater than or equal to the logging severity cause the request message and all associated messages to be logged.
        • 3 - The following information is logged:
          • Level 1 and 2 information.
          • All request messages.
          • Commands run by a CL program are logged if it is allowed by the logging of CL programs job attribute and the log attribute of the CL program.
        • 4 - The following information is logged:
          • All request messages and all messages with a severity greater than or equal to the message logging severity, including trace messages.
          • Commands run by a CL program are logged if it is allowed by the logging of CL programs job attribute and the log attribute of the CL program.
        Returns:
        The type of information logged.
      • getMessageLoggingSeverity

        public int getMessageLoggingSeverity()
        Returns the severity level that is used in conjunction with the logging level to determine which error messages are logged in the job log. The possible values are from 0 through 99.
        Returns:
        The message logging severity level.
      • getMessageLoggingText

        public java.lang.String getMessageLoggingText()
        Returns the level of message text that is written in the job log when a message is logged according to the logging level and logging severity. The possible values are:
        • "*MSG" - Only the message text is written to the job log.
        • "*SECLVL" - Both the message text and the message help (cause and recovery) of the error message are written to the job log.
        • "*NOLIST" - If the job ends normally, no job log is produced. If the job ends abnormally (if the job end code is 20 or higher), a job log is produced. The messages that appear in the job log contain both the message text and the message help.
        Returns:
        The level of message text that is written in the job log.
      • getOutputQueueLibraryName

        public java.lang.String getOutputQueueLibraryName()
        Returns the name of the library in which the output queue resides.
        Returns:
        The name of the library in which the output queue resides.
      • getOutputQueueName

        public java.lang.String getOutputQueueName()
        Returns the name of the default output queue that is used for spooled output produced by jobs that use this job description. Possible values are:
        • "*USRPRF" - The output queue name for jobs using this job description is obtained from the user profile of the job at the time the job is started.
        • "*DEV" - The output queue with the same name as the printer device for this job description is used.
        • "*WRKSTN" - The output queue name is obtained from the device description from which this job is started.
        • output-queue-name The name of the output queue for this job description.
        Returns:
        The name of the default output queue.
      • getOutputQueuePriority

        public int getOutputQueuePriority()
        Returns the output priority for spooled files that are produced by jobs using this job description. The highest priority is 1, and the lowest priority is 9.
        Returns:
        The output priority.
      • getPrinterDeviceName

        public java.lang.String getPrinterDeviceName()
        Returns the name of the printer device or the source for the name of the printer device that is used for all spooled files created by jobs that use this job description. Possible values are:
        • "*USRPRF" - The printer device name is obtained from the user profile of the job at the time the job is started.
        • "*SYSVAL" - The value in the system value QPRTDEV at the time the job is started is used as the printer device name.
        • "*WRKSTN" - The printer device name is obtained from the work station where the job was started.
        • printer-device-name - The name of the printer device that is used with this job description.
        Returns:
        The name of the printer device.
      • getPrintText

        public java.lang.String getPrintText()
        Returns the line of text (if any) that is printed at the bottom of each page of printed output for jobs using this job description.
        Returns:
        The print text.
      • getRoutingData

        public java.lang.String getRoutingData()
        Returns the routing data that is used with this job description to start jobs. The possible values are:
        • "QCMDI" - The default routing data QCMDI is used by the IBM-supplied interactive subsystem to route the job to the IBM-supplied control language processor QCMD in the QSYS library.
        • "*RQSDTA" - Up to the first 80 characters of the request data specified in the request data field are used as the routing data for the job.
        • routing-data - The routing data to use for jobs that use this job description.
        Returns:
        The routing data.
      • getSpooledFileAction

        public java.lang.String getSpooledFileAction()
        Returns the value that specifies whether spooled files can be accessed through job interfaces once a job has completed its normal activity. null if system is pre-V5R2. Possible values are:
        • "*KEEP" - Spooled files are kept with the job when the job completes its activity.
        • "*DETACH" - Spooled files are detached from the job when the job completes its activity.
        • "*SYSVAL" - The jobs using this job description will take the spooled file action specified by the QSPLFACN system value.
        Returns:
        Spooled file action. null if system is pre-V5R2.
      • getSyntaxCheckSeverity

        public int getSyntaxCheckSeverity()
        Returns whether requests placed on the job's message queue are checked for syntax as CL commands, and the message severity that causes a syntax error to end processing of a job. The possible values are:
        • -1 - The request data is not checked for syntax as CL commands.
        • 0-99 - Specifies the lowest message severity that causes a running job to end. The request data is checked for syntax as CL commands, and, if a syntax error occurs that is greater than or equal to the error message severity specified here, the running of the job that contains the erroneous command is suppressed.
        Returns:
        The syntax check severity.
      • getSystem

        public AS400 getSystem()
        Returns the system where the job description is located.
        Returns:
        The system where the job description resides.
      • getTextDescription

        public java.lang.String getTextDescription()
        Returns the user text, if any, used to briefly describe the job description.
        Returns:
        The text description. "" if no description.
      • getTimeSliceEndPool

        public java.lang.String getTimeSliceEndPool()
        Returns whether interactive jobs using this job description should be moved to another main storage pool when they reach time-slice end. The possible values are:
        • "*SYSVAL" - The system value is used.
        • "*NONE" - The job is not moved when it reaches time-slice end.
        • "*BASE" - The job is moved to the base pool when it reaches time-slice end.
        Returns:
        Whether interactive jobs using this job description should be moved to another main storage pool when they reach time-slice end.
      • getUserName

        public java.lang.String getUserName()
        Returns the name of the user profile associated with this job description.
        Returns:
        The name of the user profile associated with this job description.
      • setLibraryName

        public void setLibraryName(java.lang.String library)
        Sets the library where the job description is located. Cannot be changed if the object has established a connection to the system
        Parameters:
        library - The name of the library
      • setName

        public void setName(java.lang.String name)
        Sets the job description name. Cannot be changed after the object has established a connection to the system.
        Parameters:
        name - The job description name
      • setSystem

        public void setSystem(AS400 system)
        Sets the system. Cannot be changed after the object has established a connection to the system.
        Parameters:
        system - The system where the job description resides.
      • getObjectDescription

        public ObjectDescription getObjectDescription()
        Returns an ObjectDescription instance representing the job description.
        Returns:
        An ObjectDescription for the job description.