GET_SYSTEM_INFO stored procedure

The GET_SYSTEM_INFO stored procedure returns system information about the data server.

This system information includes:
  • Operating system information
  • Product information
  • DB2® MEPL
  • SYSMOD APPLY status
  • Workload Manager (WLM) classification rules that apply to DB2 Workload for subsystem types DB2 and DDF

Environment

Begin general-use programming interface information.

The load module for the GET_SYSTEM_INFO stored procedure, DSNADMGS, must reside in an APF-authorized library. The GET_SYSTEM_INFO stored procedure runs in a WLM-established stored procedures address space, and all of the libraries that are specified in the STEPLIB DD statement must be APF-authorized. TCB=1 is also required.

Authorization

To execute the CALL statement, the owner of the package or plan that contains the CALL statement must have EXECUTE privilege on the GET_SYSTEM_INFO stored procedure.

In addition, because the GET_SYSTEM_INFO stored procedure queries the SMPCSI data set for the status of the SYSMODs, the authorization ID that is associated with the stored procedure address space where the GET_SYSTEM_INFO stored procedure is running must have at least RACF® read authority to the SMPCSI data set.

Syntax

>>-CALL--------------------------------------------------------->

>--GET_SYSTEM_INFO--(--+-major_version-+--,--+-minor_version-+--,-->
                       '-NULL----------'     '-NULL----------'      

>--+-requested_locale-+--,--+-xml_input-+--,--+-xml_filter-+--,--xml_output--,--xml_message--)-><
   '-NULL-------------'     '-NULL------'     '-NULL-------'                                     

The schema is SYSPROC.

Option descriptions

major_version
An input and output parameter of type INTEGER that indicates the major document version. On input, this parameter indicates the major document version that you support for the XML documents passed as parameters in the stored procedure (xml_input, xml_output, and xml_message). The stored procedure processes all XML documents in the specified version, or returns an error (-20457) if the version is invalid.

On output, this parameter specifies the highest major document version that is supported by the stored procedure. To determine the highest supported document version, specify NULL for this input parameter and all other required parameters. Currently, the highest and the only major document version that is supported is 1.

If the XML document in the xml_input parameter specifies a Document Type Major Version key, the value for that key must be equal to the value that is provided in the major_version parameter, or an error (+20458) is raised.

This parameter is used in conjunction with the minor_version parameter. Therefore, you must specify both parameters together. For example, you must specify both as either NULL, or non-NULL.

minor_version
An input and output parameter of type INTEGER that indicates the minor document version. On input, this parameter specifies the minor document version that you support for the XML documents passed as parameters for this stored procedure (xml_input, xml_output, and xml_message). The stored procedure processes all XML documents in the specified version, or returns an error (-20457) if the version is invalid.

On output, this parameter indicates the highest minor document version that is supported for the highest supported major version. To determine the highest supported document version, specify NULL for this input parameter and all other required parameters. The highest minor document version that is supported is 1. Minor document version 0 (zero) is also supported.

If the XML document in the xml_input parameter specifies a Document Type Minor Version key, the value for that key must be equal to the value that is provided in the minor_version parameter, or an error (+20458) is raised.

This parameter is used in conjunction with the major_version parameter. Therefore, you must specify both parameters together. For example, you must specify both as either NULL, or non-NULL.

requested_locale
An input parameter of type VARCHAR(33) that specifies a locale. If the specified language is supported on the server, translated content is returned in the xml_output and xml_message parameters. Otherwise, content is returned in the default language. Only the language and possibly the territory information is used from the locale. The locale is not used to format numbers or influence the document encoding. For example, key names are not translated. The only translated portion of the XML output and XML message documents are Display Name, Display Unit, and Hint. The value might be globalized where applicable. You should always compare the requested language to the language that is used in the XML output document (see the Document Locale entry in the XML output document).

Currently, the supported values for requested_locale are en_US and NULL. If you specify a null value, the result is the same as specifying en_US.

xml_input
An input parameter of type BLOB(2G) that specifies an XML input document of type Data Server System Input in UTF-8 that contains input values for the stored procedure.
This XML input document is optional. If the XML input document is not passed to the stored procedure, the stored procedure returns the following information by default:
  • Operating system information
  • Product information
  • DB2 MEPL
  • Workload Manager (WLM) classification rules for DB2 Workload

This stored procedure supports two types of XML input documents, Version 1.0 or Version 1.1.

For Version 1.0, the general structure of an XML input document is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
   <key>Document Type Name</key><string>Data Server System Input</string>
   <key>Document Type Major Version</key><integer>1</integer>
   <key>Document Type Minor Version</key><integer>0</integer>
   <key>Document Locale</key><string>en_US</string>
   <key>Complete</key><false/>
   <key>Optional Parameters</key>
   <dict>
      <key>SMPCSI Data Set</key>
      <dict>
         <key>Value</key><string>SMPCSI data set name</string>
      </dict>
      <key>SYSMOD</key>
      <dict>
         <key>Value</key>
         <array>
            <string>SYSMOD number</string>
            <string>SYSMOD number</string>
         </array>
      </dict>
   </dict>
</dict>
</plist>
For Version 1.1, the general structure of an XML input document is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
   <key>Document Type Name</key><string>Data Server System Input</string>
   <key>Document Type Major Version</key><integer>1</integer>
   <key>Document Type Minor Version</key><integer>1</integer>
   <key>Document Locale</key><string>en_US</string>
   <key>Complete</key><false/>
   <key>Optional Parameters</key>
   <dict>
      <key>Include</key>
      <dict>
         <key>Value</key>
         <array>
            <string>Operating System Information</string>
            <string>Product Information</string>
            <string>DB2 MEPL</string>
            <string>Workload Manager (WLM) Classification Rules for 
                    DB2 Workload</string>    
         </array>
      </dict>
      <key>SMPCSI Data Set</key>
      <dict>
         <key>Value</key><string>SMPCSI data set name</string>
      </dict>
      <key>SYSMOD</key>
      <dict>
         <key>Value</key>
         <array>
            <string>SYSMOD number</string>
            <string>SYSMOD number</string>
         </array>
      </dict>
   </dict>
</dict>
</plist>
Version 1.0: When a Version 1.0 XML input document is passed to the stored procedure, the stored procedure returns the following information in a Version 1.0 XML output document:
  • Operating system information
  • Product information
  • DB2 MEPL
  • SYSMOD status (APPLY status for the SYSMODs that are listed in the XML input document)
  • Workload Manager (WLM) classification rules for DB2 Workload

To use Version 1.0 of the XML input document you must specify the major_version parameter as 1 and the minor_version parameter as 0 (zero). You must also specify the Document Type Name key, the SMPCSI data set, and the list of SYSMODs.

For an example of a Version 1.0 XML input document for the GET_SYSTEM_INFO stored procedure, see Example 3 in the Examples section.

Version 1.1: A Version 1.1 XML input document supports the Include parameter, in addition to the SMPCSI Data Set and SYSMOD parameters that are supported by a Version 1.0 XML input document.

You can use the Version 1.1 XML input document in the following ways:
  • To specify which items to include in the XML output document by specifying these items in the Include array
  • To specify the SMPCSI data set and list of SYSMODs so that the stored procedure returns their APPLY status
To use Version 1.1 of the XML input document, you must specify the major_version parameter as 1 and the minor_version parameter as 1. You must also specify the Document Type Name key, and at least one of the following parameters:
  • Include
  • SMPCSI Data Set and SYSMOD

If you pass a Version 1.1 XML input document to the stored procedure and specify the Include, SMPCSI Data Set, and SYSMOD parameters, the stored procedure will return the items that you specified in the Include array, and the SYSMOD status of the SYSMODs that you specified in the SYSMOD array.

If you pass a Version 1.1 XML input document to the stored procedure and specify the Include parameter only, the stored procedure will return only the items that you specified in the Include array.

If you pass a Version 1.1 XML input document to the stored procedure and specify only the SMPCSI Data Set and SYSMOD parameters, the stored procedure returns the following information in a Version 1.1 XML output document:
  • Operating system information
  • Product information
  • DB2 MEPL
  • SYSMOD status (APPLY status for the SYSMODs that are listed in the XML input document)
  • Workload Manager (WLM) classification rules for DB2 Workload

For an example of a complete Version 1.1 XML input document for the GET_SYSTEM_INFO stored procedure, see Example 4.

Complete mode: For examples of Version 1.0 and Version 1.1 XML input documents that are returned by the xml_output parameter when the stored procedure is running in Complete mode, see Example 1 and Example 2 respectively.

xml_filter
An input parameter of type BLOB(4K) in UTF-8 that specifies a valid XPath query string. Use a filter when you want to retrieve a single value from an XML output document. For more information, see XPath expressions for filtering output.
The following example selects the value for the Data Server Product Version from the XML output document:
/plist/dict/key[.='Data Server Product Version']/following-sibling::string[1]
If the key is not followed by the specified sibling, an error is returned.
xml_output
An output parameter of type BLOB(2G) that returns a complete XML output document of type Data Server System Output in UTF-8. If a filter is specified, this parameter returns a string value. If the stored procedure is unable to return a complete output document (for example, if a processing error occurs that results in an SQL warning or error), this parameter is set to NULL.

The xml_output parameter can return either a Version 1.0 or Version 1.1 XML output document depending on the major_version and minor_version parameters that you specify. For more information about the content differences between the Version 1.0 and Version 1.1 XML output documents, see the option description for the xml_input parameter.

A complete XML output document provides the following system information:
  • Operating system information
  • Product information
  • DB2 MEPL
  • The APPLY status of SYSMODs
  • Workload Manager (WLM) classification rules for DB2 Workload for subsystem types DB2 and DDF

For an example of an XML output document, see Example 5.

xml_message
An output parameter of type BLOB(64K) that returns a complete XML output document of type Data Server Message in UTF-8 that provides detailed information about a SQL warning condition. This document is returned when a call to the stored procedure results in a SQL warning, and the warning message indicates that additional information is returned in the XML message output document. If the warning message does not indicate that additional information is returned, then this parameter is set to NULL.

The xml_message parameter can return either a Version 1.0 or Version 1.1 XML message document, depending on the major_version and minor_version parameters that you specify. The format of a Version 1.0 or Version 1.1. XML message document is similar. For an example of an XML message document, see Example 6.

Examples

Example 1: The following example shows a Version 1.0 XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode.
  <?xml version="1.0" encoding="UTF-8" ?>
  <plist version="1.0">
  <dict>
     <key>Document Type Name</key><string>Data Server System Input</string>
     <key>Document Type Major Version</key><integer>1</integer>
     <key>Document Type Minor Version</key><integer>0</integer>
     <key>Document Locale</key><string>en_US</string>
     <key>Optional Parameters</key>
     <dict>
        <key>Display Name</key><string>Optional Parameters</string>
        <key>SMPCSI Data Set</key>
        <dict>
           <key>Display Name</key><string>SMPCSI Data Set</string>
           <key>Value</key><string />
           <key>Hint</key><string />
        </dict>
        <key>SYSMOD</key>
        <dict>
           <key>Display Name</key><string>SYSMOD</string>
           <key>Value</key>
           <array>
              <string />
           </array>
           <key>Hint</key><string />
        </dict>
        <key>Hint</key><string />
     </dict>
  </dict>
  </plist>
Example 2: The following example shows a Version 1.1 XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode.
  <?xml version="1.0" encoding="UTF-8" ?>
  <plist version="1.0">
  <dict>
     <key>Document Type Name</key><string>Data Server System Input</string>
     <key>Document Type Major Version</key><integer>1</integer>
     <key>Document Type Minor Version</key><integer>1</integer>
     <key>Document Locale</key><string>en_US</string>
     <key>Optional Parameters</key>
     <dict>
        <key>Display Name</key><string>Optional Parameters</string>
        <key>Include</key>
        <dict>
           <key>Display Name</key><string>Include</string>
           <key>Value</key>
           <array>
              <string>Operating System Information</string>
              <string>Product Information</string>
              <string>DB2 MEPL</string>
              <string>Workload Manager (WLM) Classification Rules for 
                      DB2 Workload</string>
           </array>
           <key>Hint</key><string />
        </dict>
        <key>SMPCSI Data Set</key>
        <dict>
           <key>Display Name</key><string>SMPCSI Data Set</string>
           <key>Value</key><string />
           <key>Hint</key><string />
        </dict>
        <key>SYSMOD</key>
        <dict>
           <key>Display Name</key><string>SYSMOD</string>
           <key>Value</key>
           <array>
              <string />
           </array>
           <key>Hint</key><string />
        </dict>
        <key>Hint</key><string />
     </dict>
  </dict>
  </plist>
Example 3: The following example shows a complete sample of a Version 1.0 XML input document for the GET_SYSTEM_INFO stored procedure.
<?xml version="1.0"  encoding="UTF-8"?>
<plist version="1.0">
<dict>
   <key>Document Type Name</key>
   <string>Data Server System Input</string>
   <key>Document Type Major Version</key><integer>1</integer>
   <key>Document Type Minor Version</key><integer>0</integer>
   <key>Document Locale</key><string>en_US</string>
   <key>Optional Parameters</key>
   <dict>
      <key>SMPCSI Data Set</key>
      <dict>
         <key>Value</key><string>IXM180.GLOBAL.CSI</string>
      </dict>
      <key>SYSMOD</key>
      <dict>
         <key>Value</key>
         <array>
            <string>UK20028</string>
            <string>UK20030</string>
         </array>
      </dict>
   </dict>
</dict>
</plist>

You must specify the SMPCSI data set and one or more SYSMODs. SYSMOD status information will be returned for only the SYSMODs that are listed in the Optional Parameters section, provided that the SMPCSI data set that you specify is valid.

Example 4: The following example shows a complete sample of a Version 1.1 XML input document for the GET_SYSTEM_INFO stored procedure.
<?xml version="1.0"  encoding="UTF-8"?>
<plist version="1.0">
<dict>
   <key>Document Type Name</key><string>Data Server System Input</string>
   <key>Document Type Major Version</key><integer>1</integer>
   <key>Document Type Minor Version</key><integer>1</integer>
   <key>Document Locale</key><string>en_US</string>
   <key>Optional Parameters</key>
   <dict>
      <key>Include</key>
      <dict>
         <key>Value</key>
         <array>
            <string>Operating System Information</string>
            <string>Product Information</string>
            <string>DB2 MEPL</string>
            <string>Workload Manager (WLM) Classification Rules for 
                    DB2 Workload</string> 
         </array>
      </dict>
      <key>SMPCSI Data Set</key>
      <dict>
	       <key>Value</key><string>IXM180.GLOBAL.CSI</string>
      </dict>
      <key>SYSMOD</key>
      <dict>
         <key>Value</key>
         <array>
            <string>UK24596</string>
            <string>UK24709</string>
         </array>
      </dict>
   </dict>
</dict>
</plist>
Example 5: The following example shows a fragment of an XML output document for the GET_SYSTEM_INFO stored procedure. In this example, the ellipsis (. . .) represent a dictionary entry that is comprised of Display Name, Value, and Hint, such as:
<dict>
  <key>Display Name</key>
  <string>Name</string>
  <key>Value</key>
  <string>JES2</string>
  <key>Hint</key>
  <string />
</dict>
<?xml version="1.0" encoding="UTF-8" ?> 
<plist version="1.0">
<dict>
  <key>Document Type Name</key> 
  <string>Data Server System Output</string> 
  <key>Document Type Major Version</key> 
  <integer>1</integer> 
  <key>Document Type Minor Version</key> 
  <integer>1</integer> 
  <key>Data Server Product Name</key> 
  <string>DSN</string> 
  <key>Data Server Product Version</key> 
  <string>9.1.5</string> 
  <key>Data Server Major Version</key> 
  <integer>9</integer> 
  <key>Data Server Minor Version</key> 
  <integer>1</integer> 
  <key>Data Server Platform</key> 
  <string>z/OS</string> 
  <key>Document Locale</key> 
  <string>en_US</string> 
  <key>Operating System Information</key> 
  <dict>
    <key>Display Name</key><string>Operating System Information</string> 
    <key>Name and Release</key> 
    ...
    <key>CPU</key> 
    <dict>
      <key>Display Name</key><string>CPU</string> 
      <key>Model</key> 
      ...
      <key>Number of Online CPUs</key> 
      ...
      <key>Online CPUs</key> 
      <dict>
        <key>Display Name</key><string>Online CPUs</string> 
        <key>CPU ID 01</key> 
        <dict>
          <key>Display Name</key><string>CPU ID 01</string> 
          <key>Serial Number</key> 
          ...
          <key>Hint</key><string /> 
        </dict>
        <key>Hint</key><string /> 
      </dict>
      <key>Hint</key><string /> 
    </dict>
    <key>Real Storage Size</key> 
    <dict>
      <key>Display Name</key><string>Real Storage Size</string> 
      <key>Value</key><integer>256</integer> 
      <key>Display Unit</key><string>MB</string> 
      <key>Hint</key><string /> 
    </dict>
    <key>Sysplex Name</key>
    <dict>
      <key>Display Name</key>
      <string>Sysplex Name</string>
      <key>Value</key>
      <string>XESDEV</string>
      <key>Hint</key>
      <string />
    </dict>
  </dict>

  <key>Product Information</key> 
  <dict>
    <key>Display Name</key><string>Product Information</string> 
    <key>Primary Job Entry Subsystem</key> 
    <dict>
      <key>Display Name</key><string>Primary Job Entry Subsystem</string> 
      <key>Name</key> 
      ...
      <key>Release</key> 
      ...
      <key>Node Name</key> 
      ...
      <key>Held Output Class</key> 
      ...
      <key>Hint</key><string /> 
    </dict>
    <key>Security Software</key> 
    <dict>
      <key>Display Name</key><string>Security Software</string> 
      <key>Name</key> 
      ...
      <key>FMID</key> 
      ...
      <key>Hint</key><string /> 
    </dict>
    <key>DFSMS Release</key> 
    ...
    <key>TSO Release</key> 
    ...
    <key>VTAM Release</key> 
    ...
    <key>Hint</key><string /> 
  </dict>

  <key>DB2 MEPL</key> 
  <dict>
    <key>Display Name</key><string>DB2 MEPL</string> 
    <key>DSNUTILB</key> 
    <dict>
      <key>Display Name</key><string>DSNUTILB</string> 
      <key>DSNAA</key> 
      <dict>
        <key>Display Name</key><string>DSNAA</string> 
        <key>PTF Level</key> 
        ...
        <key>PTF Apply Date</key> 
        ...
        <key>Hint</key><string /> 
      </dict>
      
      --- This is only a fragment of the utility modules that
          are returned by the GET_SYSTEM_INFO stored procedure. ---
          
      <key>Hint</key><string></string>
    </dict>
    
    --- This is only a fragment of the 
        DB2 MEPL information that is returned by
        the GET_SYSTEM_INFO stored procedure. ---

  </dict>

  <key>SYSMOD Status</key> 
  <dict>
    <key>Display Name</key><string>SYSMOD Status</string> 
    <key>AA15195</key> 
    <dict>
      <key>Display Name</key><string>AA15195</string> 
      <key>Apply</key> 
      ...
      <key>Apply Date</key> 
      ...
      <key>Hint</key><string /> 
    </dict>
  
    --- This is only a fragment of the SYSMOD
        status information that is returned by
        the GET_SYSTEM_INFO stored procedure. --- 
          
  </dict>

  <key>Workload Manager (WLM) Classification Rules for DB2 Workload</key> 
  <dict>
    <key>Display Name</key> 
    <string>Workload Manager (WLM) Classification Rules for DB2 Workload</string> 
    <key>DB2</key> 
    <dict>
      <key>Display Name</key><string>DB2</string> 
      <key>Hint</key><string /> 
    </dict>
    <key>DDF</key> 
    <dict>
      <key>Display Name</key><string>DDF</string> 
      <key>1.1.1</key> 
      <dict>
        <key>Display Name</key><string>1.1.1</string> 
        <key>Nesting Level</key> 
        ...
        <key>Qualifier Type</key> 
        ...
        <key>Qualifier Type Full Name</key> 
        ...
        <key>Qualifier Name</key> 
        ...
        <key>Start Position</key> 
        ...
        <key>Service Class</key> 
        ...
        <key>Report Class</key> 
        ...
        <key>Hint</key><string /> 
      </dict>
      <key>2.1.1</key> 
      <dict>
        --- This dictionary entry describes the second classification 
             rule, and its format is the same as that of 1.1.1 above,
             which describes the first classification rule. ---
      </dict>
      <key>Hint</key><string /> 
    </dict>
    <key>Hint</key><string /> 
  </dict>
</dict>
</plist>
Example 6: The following example shows a sample XML message document for the GET_SYSTEM_INFO stored procedure. Similar to an XML output document, the details about an SQL warning condition will be encapsulated in a dictionary entry, which is comprised of Display Name, Value, and Hint.
<?xml version="1.0" encoding="UTF-8" ?>
  <plist version="1.0">
  <dict>
     <key>Document Type Name</key><string>Data Server Message</string>
     <key>Document Type Major Version</key><integer>1</integer>
     <key>Document Type Minor Version</key><integer>1</integer>
     <key>Data Server Product Name</key><string>DSN</string>
     <key>Data Server Product Version</key><string>9.1.5</string>
     <key>Data Server Major Version</key><integer>9</integer>
     <key>Data Server Minor Version</key><integer>1</integer>
     <key>Data Server Platform</key><string>z/OS</string>
     <key>Document Locale</key><string>en_US</string>
     <key>Short Message Text</key>
     <dict>
        <key>Display Name</key><string>Short Message Text</string>
        <key>Value</key>
        <string>DSNA647I DSNADMGS INVOCATION OF GIMAPI FAILED. Error processing 
                command: QUERY . RC=12 CC=50504. GIM54701W ALLOCATION FAILED FOR 
                SMPCSI - IKJ56228I DATA SET IXM180.GLOBAL.CSI NOT IN CATALOG OR 
                CATALOG CAN NOT BE ACCESSED. GIM44232I GIMMPVIA - DYNAMIC 
                ALLOCATION FAILED FOR THE GLOBAL ZONE, DATA SET IXM180.GLOBAL.CSI.
                GIM50504S ** OPEN PROCESSING FAILED FOR THE GLOBAL ZONE.</string>
        <key>Hint</key><string />
     </dict>
  </dict>
  </plist>

Example 7: This example shows a simple and static Java program that calls the GET_SYSTEM_INFO stored procedure with an XML input document and an XPath that queries the value of the operating system name and release.

The XML input document is initially saved as a file called xml_input.xml that is in the same directory where the GetSystemDriver class resides. This sample program uses the following xml_input.xml file:
<?xml version="1.0" encoding="UTF-8" ?> 
<plist version="1.0">
  <dict>
    <key>Document Type Name</key> 
    <string>Data Server System Input</string> 
    <key>Document Type Major Version</key> 
    <integer>1</integer> 
    <key>Document Type Minor Version</key> 
    <integer>1</integer> 
    <key>Document Locale</key> 
    <string>en_US</string> 
    <key>Optional Parameters</key> 
    <dict>
      <key>Include</key> 
      <dict>
        <key>Value</key> 
        <array>
          <string>Operating System Information</string> 
        </array>
      </dict>
    </dict>
  </dict>
</plist>

The XPath is statically created as a string object by the program and then converted to a BLOB to serve as input for the xml_filter parameter. After the stored procedure is called, the xml_output parameter contains only a single string and no XML document. This output is materialized as a file called xml_output.xml that is in the same directory where the GetSystemDriver class resides.

Sample invocation of the GET_SYSTEM_INFO stored procedure with a valid XML input document and a valid XPath:
//***************************************************************************
// Licensed Materials - Property of IBM
// 5635-DB2
// (C) COPYRIGHT 1982, 2006 IBM Corp. All Rights Reserved.
//
// STATUS = Version 9
//***************************************************************************
// Source file name: GetSystemDriver.java
//
// Sample: How to call SYSPROC.GET_SYSTEM_INFO with a valid XML input document
// and a valid XPath to extract the operating system name and release.
//
// The user runs the program by issuing:
// java GetSystemDriver <alias or //server/database> <userid> <password>
//
// The arguments are:
// <alias> - DB2 subsystem alias for type 2 or //server/database for type 4
//    connectivity
// <userid> - user ID to connect as
// <password> - password to connect with
//***************************************************************************
import java.io.*;
import java.sql.*;

public class GetSystemDriver
{
   
   public static void main (String[] args)
   {
      Connection con = null;
      CallableStatement cstmt = null;
      String driver = "com.ibm.db2.jcc.DB2Driver";
      String url = "jdbc:db2:";
      String userid = null;
      String password = null;
      
      // Parse arguments
      if (args.length != 3)
      {
        System.err.println("Usage: GetSystemDriver <alias or //server/database> 
<userid> <password>");
        System.err.println("where <alias or //server/database> is DB2 subsystem 
alias or //server/database for type 4 connectivity");
        System.err.println(" <userid> is user ID to connect as");
        System.err.println(" <password> is password to connect with");
        return;
      }
      url += args[0];
      userid = args[1];
      password = args[2];
      
      try {
      
        String str_xmlfilter = new String(    
          "/plist/dict/key[.='Operating System Information']/following-sibling::
dict[1]" +
          "/key[.='Name and Release']/following-sibling::dict[1]" +
          "/key[.='Value']/following-sibling::string[1]");
        
        // Convert XML_FILTER to byte array to pass as BLOB 
        byte[] xml_filter = str_xmlfilter.getBytes("UTF-8");        
        
	      // Read XML_INPUT from file 
	      File fptr = new File("xml_input.xml"); 
	    
	      int file_length =  (int)fptr.length();
	      byte[] xml_input = new byte[file_length];
	
	      FileInputStream instream = new FileInputStream(fptr);
	      int tot_bytes = instream.read(xml_input,0, xml_input.length);
	      if (tot_bytes == -1) {
	        System.out.println("Error during file read");
          return;   
        }
	      instream.close();
               
        // Load the DB2 Universal JDBC Driver
        Class.forName(driver);
        
        // Connect to database
        con = DriverManager.getConnection(url, userid, password);
        con.setAutoCommit(false);
        
        cstmt = con.prepareCall("CALL SYSPROC.GET_SYSTEM_INFO(?,?,?,?,?,?,?)");
        
        // Major / Minor Version / Requested Locale
        cstmt.setInt(1, 1);
        cstmt.setInt(2, 1);
        cstmt.setString(3, "en_US");
        
        // Input documents
        cstmt.setObject(4, xml_input, Types.BLOB);
        cstmt.setObject(5, xml_filter, Types.BLOB);
        
        // Output Parms
        cstmt.registerOutParameter(1, Types.INTEGER);
        cstmt.registerOutParameter(2, Types.INTEGER);
        cstmt.registerOutParameter(6, Types.BLOB);
        cstmt.registerOutParameter(7, Types.BLOB);
        
        cstmt.execute();
        con.commit();
       
        SQLWarning ctstmt_warning = cstmt.getWarnings();
        if (ctstmt_warning != null) {
          System.out.println("SQL Warning: " + ctstmt_warning.getMessage());
        }
        else {
          System.out.println("SQL Warning: None\r\n");
        }
        
        System.out.println("Major Version returned " + cstmt.getInt(1) );
        System.out.println("Minor Version returned " + cstmt.getInt(2) );
        
        // Get output BLOBs 
        Blob b_out = cstmt.getBlob(6);
        
        if(b_out != null)
        {
          int out_length = (int)b_out.length();
          byte[] bxml_output = new byte[out_length];
          
          // Open an inputstream on BLOB data 
          InputStream instr_out = b_out.getBinaryStream();
          
          // Copy from inputstream into byte array 
          int out_len = instr_out.read(bxml_output, 0, out_length);
          
          // Write byte array content into FileOutputStream 
          FileOutputStream fxml_out = new FileOutputStream("xml_output.xml");
          fxml_out.write(bxml_output, 0, out_length );
          
          //Close streams
          instr_out.close();
          fxml_out.close();
        }
        
        Blob b_msg = cstmt.getBlob(7);
        
        if(b_msg != null)
        {
          int msg_length = (int)b_msg.length();
          byte[] bxml_message = new byte[msg_length];
          
          // Open an inputstream on BLOB data 
          InputStream instr_msg = b_msg.getBinaryStream();
          
          // Copy from inputstream into byte array 
          int msg_len = instr_msg.read(bxml_message, 0, msg_length);
          
          // Write byte array content into FileOutputStream 
          FileOutputStream fxml_msg = new FileOutputStream(new File("xml_message.
xml"));
          fxml_msg.write(bxml_message, 0, msg_length);
          
          //Close streams
          instr_msg.close();
          fxml_msg.close();
        }
      }
      
      catch (SQLException sqle) {
         System.out.println("Error during CALL "
               + " SQLSTATE = " + sqle.getSQLState()
               + " SQLCODE = " + sqle.getErrorCode()
               + " : " + sqle.getMessage());
      }
      
      catch (Exception e) {
         System.out.println("Internal Error " + e.toString());
      }
      
      finally
      {
         if(cstmt != null)
            try { cstmt.close(); } catch ( SQLException sqle) 
{ sqle.printStackTrace(); }
         if(con != null)
            try { con.close(); } catch ( SQLException sqle) 
{ sqle.printStackTrace(); }
      }
   }
}

End general-use programming interface information.