Rational Developer for System z, Version 7.6

Getting the list of systems

This sample demonstrates how you can programmatically obtain the list of system objects that are currently defined. Through a system object, you can obtain basic properties such as the name, the IP address, and the connection status of the system.

Sample Scenario

To retrieve information about z/OS® systems, select the API Samples > Systems Information. action.

Artwork for listSystemsMenu

For each system that is defined, the name, IP address, and connection status is displayed in the standard output associated with the workbench. This can be found in the DOS window from which the workbench was started, or in the Console view of the hosting workbench in the case of the runtime workbench.

Note: The standard output for a workbench started with the standard Eclipse icon may not be visible depending on the runtime settings for the workbench.

Artwork for listSystemsResults

Sample Code Walk-through

Retrieving System List and Obtaining System Properties

The following code snippet from the ListSystemsAction class contains the core of the sample.

 Object [] systemReferences = PhysicalSystemRegistryFactory.
		getSingleton().getSystems(IPopulatorConstants.MVSFiles);

	for (int i = 0; i < systemReferences.length; i++) {
		if (systemReferences[i] instanceof IOSImage) {
			IOSImage system = (IOSImage) systemReferences[i];
			System.out.println("----------");
			System.out.println("System " + i + ": " + 
				system.getName());
			System.out.println("IP address = " + 
				system.getIpAddress());
			if (system.isConnected()) {
				System.out.println("System is currently connected.");
			} else {
				System.out.println(
					"System is not currently connected.");
			}
		}
	}

It starts by using the PhysicalSystemRegistry class, obtained using the getSingleton method of the PhysicalSystemRegistryFactory class, to retrieve the IOSImage objects representing the MVS™ subsystem of the systems defined in the workspace. Then it iterates through each of the (sub)systems, and prints out the following information:

  • Name of the connection (getName)
  • IP address of the connection (getIpAddress)
  • Connection status (isConnected)
The menu item is contributed to the workbench through an Eclipse action set:
  <extension
         id="com.ibm.ftt.api.samples.actionSets"
         name="%apiSample.actionSets"
         point="org.eclipse.ui.actionSets">
      <actionSet label="com.ibm.ftt.api.samples.actionSet1"
            description="Action set for the API samples"
            visible="true"
            id="com.ibm.ftt.api.samples.actionSet1">
         <menu label="%apiMenu.title"
               id="com.ibm.ftt.api.samples.apiMenu">
            <separator name="com.ibm.ftt.api.samples.apiMenu.resourcesAPI"/>
         </menu>
         <action label="%apiMenu.samples.listSystems"
               class="com.ibm.ftt.api.samples.resources.ListSystemsAction"
               style="push" menubarPath=
    "com.ibm.ftt.api.samples.apiMenu/com.ibm.ftt.api.samples.apiMenu.resourcesAPI"
               id="com.ibm.ftt.api.samples.listSystemsAction"/>
               ......
      </actionSet>
   </extension>

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)