[AIX HP-UX Linux Solaris Windows]This topic applies only on the z/OS operating system.

Submitting batch jobs using the job scheduler EJB interface

The job scheduler Enterprise JavaBeans™ (EJB) interface is used to programmatically submit and manipulate a batch job. You can use the EJB interface with the base scheduler in WebSphere® Application Server to perform calendar-based submission of a batch job.

[oct2010]

Before you begin

The job scheduler supports programmatic access to its functions over both an EJB interface for Java™ Platform, Enterprise Edition (Java EE) applications and a web services interface for both Java EE and non-Java EE applications. The EJB interface for the job scheduler is described by the interfaces found in the API documentation. Consult this documentation for further information.

[oct2010] Develop and install your batch applications. [oct2010]

oct2010

[oct2010]
oct2010

About this task

This topic describes how to submit a batch job to the job scheduler using the base scheduler in WebSphere Application Server. It includes a code example that demonstrates how to invoke the job scheduler EJB.

Procedure

  1. Create and configure a scheduler. Read about how to create and configure a scheduler in the topic on developing and scheduling tasks.
  2. Create a scheduler task for submitting batch work.

    This scheduler task invokes the job scheduler EJB to submit a batch job. Read the instructions for creating a task that invokes an EJB in the topic on developing a task that calls a session bean. This topic also includes instructions for using the calendaring feature of the WebSphere scheduler. The following example demonstrates on how to invoke the job scheduler EJB:

    // These are the import statements needed by the task
    import javax.naming.*;
    
    import com.ibm.websphere.longrun.JobScheduler;
    import com.ibm.websphere.longrun.JobSchedulerHome
    
    
    private JobSchedulerHome zjsHome = null;
    private JobScheduler zjs = null;
    
    
    public void process(TaskStatus task) ()
    try{
    
         //Ensure that the xJCL can be placed in a string, for example, by reading an xJCL
         //File into a string
         String xJCL = <xJCL as a string>;
    
         //Obtain cell-level naming context
         InitialContext ctxt = new InitialContext();
         Hashtable env = new Hashtable();
    
         env.put (Context.INITIAL_CONTEXT_FACTORY,
         "com.ibm.websphere.naming.WsnInitialContextFactory");
    
         env.put(Context.PROVIDER_URL,"corbaloc:rir:/NameServiceCellRoot");
         ctxt = new InitialContext(env);
    
         //To look up the LRS EJB from the cell context in the namespace,
         //The name context to the application server or cluster to which the LRS 
         //Application is deployed has to be provided
         //Eg: "nodes/myNode/servers/myServer" or "clusters/myCluster".
    
         String longRunningContext = <long_running_context>;
    
    
         zjsHome = (JobSchedulerHome) ctxt.lookup(longRunningContext +
         "/ejb/com/ibm/websphere/longrun/JobSchedulerHome");
         zjs = zjsHome.create();
         zjs.submitJob( xJCL );
    
    }catch (Exception e) {
    System.out.println(e.getMessage());
    }
    
  3. Run the program to submit batch work.

    Read the topic on submitting a task to a scheduler.




Related concepts
The job scheduler EJB interfaces
Job logs
Related tasks
Submitting batch jobs using the job scheduler web services interface
Developing and scheduling tasks
Developing a task that calls a session bean
Submitting a task to a scheduler
Task topic    

Terms of Use | Feedback

Last updated: Oct 14, 2010 12:24:18 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v700compg&product=was-nd-mp&topic=tgrid_xdbgusweb
File name: tgrid_xdbgusweb.html