IBM i jobs

An IBM i job runs the command you specify on an IBM i system (formerly known as AS/400 and i5 OS).

This section describes the required and optional attributes for IBM i jobs. Each job definition has the following format and arguments:
Table 1. Required and optional attributes for the definition of an IBM i job.
Attribute Description/value Required
application name ibmi
user name The user name authorized to run the job on the IBMi system.
otherCommandType The generic command to be run on the IBM i system. Required for generic type command
SBMJOBType The SBMJOB command to be run on the IBM i system. Required for SBMJOB type command
jobName The name of the job that is associated with the submitted job while it is being processed by the system.
jobDescription The job description used to submit jobs for batch processing.
jobDescriptionLibrary The library that qualifies the job description.
jobQueue The qualified name of the job queue on which the job is placed.
jobQueueLibrary The library that qualifies the job queue.
jobPriority The scheduling priority for the submitted job.
outputPriority The output priority for spooled files that are produced by the submitted job.
outputQueue The qualified name of the output queue used for spooled files.
outputQueueLibrary The library that qualifies the output queue.
printDevice The qualified name of the default printer device for the submitted job.
systemLibraryList The system portion of the initial library list that is used by the submitted job.
currentLibrary The name of the current library associated with the submitted job.
initialLibraryList The initial user part of the library list that is used to search for any object names that were specified without a library qualifier.
Child job options The list of options to define if monitoring child jobs or not. Choose one of the following options:
Use agent settings
Depending on the variable defined on the IBM i agent, child jobs are monitored or not.
Follow child jobs
Child jobs are monitored.
Ignore child jobs
Child jobs are not monitored.
LDA source (library name/name) The name of the library and the name of the Local Data Area (LDA).
msgReplyList The list of messages for which you want to define an automated reply. For each message, specify:
msgReply
msgId
The message identifier.
msgCmpDta
The message text.
msgRpy
The automated reply that you want to define.
Message Max Replies
The maximum number of automated replies accepted for the message. Valid range is from 0 to 100. Default value is 10. If 0 is specified, the automated reply to the message is disabled.
For more information about how to define the Submit Job (SBMJOB) command parameters, see IBM i product documentation.
The following example shows a job that issues a SBMJOB command with the related parameters:

$JOBS
IBMI72_94#IBMI_NEWDEF_TEST
</jsdlibmi:commandTypeGroup>
</jsdlibmi:Task>
<jsdlibmi:credential>
<jsdlibmi:userName>userName</jsdlibmi:userName>
</jsdlibmi:credential>
</jsdlibmi:IBMIParameters>
</jsdlibmi:ibmi>
(indent <jsdlibmi:credential> and </jsdlibmi:credential> at the same level of </jsdlibmi:Task>)
 TASK
 <?xml version="1.0" encoding="UTF-8"?>
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" 
xmlns:jsdlibmi="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdlibmi" name="ibmi">
  <jsdl:application name="ibmi">
    <jsdlibmi:ibmi>
            <jsdlibmi:IBMIParameters>
                <jsdlibmi:Task>
                    <jsdlibmi:command>WRKSYSSTS</jsdlibmi:command>
                    <jsdlibmi:commandTypeGroup>
                        <jsdlibmi:SBMJOBType>
                            <jsdlibmi:jobName>TESTMEL</jsdlibmi:jobName>
                            <jsdlibmi:jobDescription>QDFTJOBD</jsdlibmi:jobDescription>
                            <jsdlibmi:jobDescriptionLibrary>QGPL</jsdlibmi:jobDescriptionLibrary>
                            <jsdlibmi:jobQueue/>
                            <jsdlibmi:jobQueueLibrary/>
                            <jsdlibmi:jobPriority>3</jsdlibmi:jobPriority>
                            <jsdlibmi:outputPriority>4</jsdlibmi:outputPriority>
                            <jsdlibmi:outputQueue>*DEV</jsdlibmi:outputQueue>
                            <jsdlibmi:outputQueueLibrary/>
                            <jsdlibmi:printDevice>PRT01</jsdlibmi:printDevice>
                            <jsdlibmi:systemLibraryList/>
                            <jsdlibmi:currentLibrary>*CRTDFT</jsdlibmi:currentLibrary>
                            <jsdlibmi:initialLibraryList>QGPL       QTEMP      QDEVELOP
                                QBLDSYS</jsdlibmi:initialLibraryList>
                        </jsdlibmi:SBMJOBType>
                    </jsdlibmi:commandTypeGroup>
                </jsdlibmi:Task>
            </jsdlibmi:IBMIParameters>
        </jsdlibmi:ibmi>
  </jsdl:application>
</jsdl:jobDefinition>
 RECOVERY STOP
Note: The user needs full access, that is possibility of creating files and directories and changing their ownership to the agent stdlist directory (agent_data_dir/stdlist/JM )
The following example shows a job that runs a command on an IBM i system and defines automated message replies, both for parent and child IBM i jobs . For more information about defining an automated reply for a message, see Scheduling and monitoring jobs on IBM i systems.

$JOBS
AGTIBMI_MEL#IBMI_MSG_REPLY
 TASK
    <?xml version="1.0" encoding="UTF-8"?>
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" 
xmlns:jsdlibmi="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdlibmi" name="ibmi">
  <jsdl:application name="ibmi">
    <jsdlibmi:ibmi>
            <jsdlibmi:IBMIParameters>
               <jsdlibmi:Task>
                    <jsdlibmi:command>SBMJOB CMD(CALL PGM(MINERMA/SENDMSGALL)) INQMSGRPY(*SYSRPYL)
                    </jsdlibmi:command>
                    <jsdlibmi:commandTypeGroup>
                        <jsdlibmi:otherCommandType/>
                    </jsdlibmi:commandTypeGroup>
                    <jsdlibmi:msgReplyList>
                        <jsdlibmi:msgReply>
                            <jsdlibmi:msgId>CPA2401/jsdlibmi:msgId>
                            <jsdlibmi:msgCmpDta>*/jsdlibmi:msgCmpDta>
                            <jsdlibmi:msgRpy>Y/jsdlibmi:msgRpy>
                            <jsdlibmi:msgMaxReplies>2/jsdlibmi:msgMaxReplies>
                        </jsdlibmi:msgReply>
                        <jsdlibmi:msgReply>
                            <jsdlibmi:msgId>CPA24*/jsdlibmi:msgId>
                            <jsdlibmi:msgCmpDta>*1*/jsdlibmi:msgCmpDta>
                            <jsdlibmi:msgRpy>Y/jsdlibmi:msgRpy>
                            <jsdlibmi:msgMaxReplies>54/jsdlibmi:msgMaxReplies>
                        </jsdlibmi:msgReply>
                    </jsdlibmi:msgReplyList>
                </jsdlibmi:Task>
            </jsdlibmi:IBMIParameters>
        </jsdlibmi:ibmi>
  </jsdl:application>
</jsdl:jobDefinition>
 RECOVERY STOP

See also

From the Dynamic Workload Console you can perform the same task as described in

Creating job definitions.

For more information about how to create and edit scheduling objects, see

Designing your Workload.