Implementing IBM I job management with IBM Java Toolbox for I (ii)

Source: Internet
Author: User
Tags require

IBM Java Toolbox for I programming support for IBM I subsystem

In addition to queues, subsystems are also a major feature of IBM I. IBM I supports multiple types of jobs to meet the needs of the user. Different kinds of job requirements for system resources are different, for example, interactive jobs require faster response time, batch jobs may require more CPU time, and so on. In order to use system resources more rationally and efficiently, the system is divided into several subsystems (subsystem), and all jobs are run under the control of subsystem. Therefore, the subsystem is considered to be a specially configured environment for running a certain type of job.

From the Object-oriented programming model perspective, IBM Java Toolbox for I uses the Subsystem class (located in the Com.ibm.as400.access package) to describe the IBM I subsystem object.

As an example, listing 4 describes the properties and functions of subsystem qhttpsvr, which serve HTTP server jobs.

Listing 4. QHTTPSVR Subsystem

Constructs the AS400 object to establish a connection between the Java application and the IBM I server.

AS400 sys = new AS400 (System, USR, pwd);

SUBSYSTEM SBS = new subsystem (SYS, "qhttpsvr", "qhttpsvr");

if (!sbs.exists ()) {

System.out.println ("No such subsystem:" +sbs.getpath ());

}

else {

Sbs.refresh ();

System.out.println ("Status:" + sbs.getstatus ());

System.out.println ("Number of jobs:" + sbs.getcurrentactivejobs ());

System.out.println ("Maximum jobs:" + sbs.getmaximumactivejobs ());

Wait 1 hours to stop subsystem

Sbs.end (3600);

}

As a good programming habit, release the connection

Sys.disconnectallservices ();

As with jobs, the subsystem itself is not an IBM I object, but the subsystem description (subsystem Description) is an object (*SBSD). The subsystem description defines the memory resources in the subsystem, the types of jobs that are run in the subsystem, and the maximum number of jobs. Unlike jobs, each subsystem description corresponds to only one subsystem, so the subsystem can be used to describe the object's name to differentiate between the subsystems.

From an object-oriented programming model perspective, although IBM Java Toolbox for I did not provide a dedicated subsystemdescription class to describe the IBM I subsystem descriptor object, but instead of creating a subsystem using the Subsystem class, Automatically creates a description object for the IBM I subsystem with the same name inside the code.

As an example, listing 5 describes the creation of subsystem Mysubsys, while IBM I generates an identically named and child system description object.

Listing 5. Creating subsystems and Subsystem description objects

Constructs the AS400 object to establish a connection between the Java application and the IBM I server.

AS400 sys = new AS400 (System, USR, pwd);

When a subsystem object is created, the subsystem description object of the same name is also created.

SUBSYSTEM SBS = new subsystem (SYS, "QSYS", "Mysubsys");

if (sbs.exists ()) {

SYSTEM.OUT.PRINTLN ("Subsystem Description:" +sbs.getpath () + "exists");

}

else {

Sbs.create ();

SYSTEM.OUT.PRINTLN ("Subsystem Description:" + Sbs.getpath ());

System.out.println ("Number of jobs:" + sbs.getcurrentactivejobs ());

System.out.println ("Maximum jobs:" + sbs.getmaximumactivejobs ());

}

As a good programming habit, release the connection

Sys.disconnectallservices ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.