GET_CONFIG stored procedure

The GET_CONFIG stored procedure retrieves data server configuration information.

This data server configuration information includes:
  • Data sharing group information
  • DB2® subsystem status information
  • Start of changeDB2 subsystem parameters, DSNHDECP or a user-specified application defaults module, and the IRLM parameters that are found in IFCID 106 section 5End of change
  • DB2 distributed access information
  • Active log data set information
  • The time of the last restart of DB2
  • Resource limit facility information
  • Connected DB2 subsystems information

Environment

Begin general-use programming interface information.

The GET_CONFIG stored procedure runs in a WLM-established stored procedures address space.

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_CONFIG stored procedure.

Syntax

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

>--GET_CONFIG--(--+-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 that are 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 procedure. To determine the highest supported document version, specify NULL for this input parameter and all other required parameters. Currently, the highest major document version that is supported is 2. Major document version 1 is also supported.

If the XML document in the xml_input parameter specifies the Document Type Major Version key, the value for that key must be equal to the value 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 that are 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. Currently, the highest and only minor document version that is supported is 0 (zero).

If the XML document in the xml_input parameter specifies the Document Type Minor Version key, the value for that key must be equal to the value 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 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 Configuration Input in UTF-8 that contains input values for the stored procedure.

To pass an XML input document to the stored procedure, you must specify the major_version parameter as 2 and the minor_version parameter as 0 (zero).

For a non-data sharing system, a sample of a Version 2.0 XML input document is as follows:
  <plist version="1.0"> 
  <?xml version="1.0" encoding="UTF-8" ?> 
  <dict>
    <key>Document Type Name</key>    
    <string>Data Server Configuration Input</string>
    <key>Document Type Major Version</key>
    <integer>2</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>Include</key>
      <dict>
        <key>Value</key>
        <array>
          <string>DB2 Subsystem Status Information</string>
          <string>DB2 Subsystem Parameters</string>
          <string>DB2 Distributed Access Information</string>
          <string>Active Log Data Set Information</string>
          <string>Time of Last DB2 Restart</string>
          <string>Resource Limit Facility Information</string>
          <string>Connected DB2 Subsystem</string>
        </array>
      </dict>
    </dict>
  </dict>
  </plist>
For a data sharing system, a sample of a Version 2.0 XML input document is as follows:
  <plist version="1.0"> 
  <?xml version="1.0" encoding="UTF-8" ?>
  <dict>
    <key>Document Type Name</key>
    <string>Data Server Configuration Input</string>
    <key>Document Type Major Version</key>
    <integer>2</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>Include</key>
      <dict>
        <key>Value</key>
        <array>
          <string>Common Data Sharing Group Information</string>
          <string>DB2 Subsystem Status Information</string>
          <string>DB2 Subsystem Parameters</string>
          <string>DB2 Distributed Access Information</string>
          <string>Active Log Data Set Information</string>
          <string>Time of Last DB2 Restart</string>
          <string>Resource Limit Facility Information</string>
          <string>Connected DB2 Subsystem</string>
        </array>
      </dict>
      <key>DB2 Data Sharing Group Members</key>
      <dict>
        <key>Value</key>
        <array>
          <string>DB2A</string>
          <string>DB2B</string>
        </array>
      </dict>
    </dict>
  </dict>
  </plist>
When passing an XML input document to the stored procedure, you must specify the Document Type Name key. In a non-data sharing system, you must specify the Include parameter. In a data sharing system, you must specify at least one of the following parameters:
  • Include
  • DB2 Data Sharing Group Members
If no XML input document is passed to the stored procedure, and you specified the major_version parameter as 2 and the minor_version parameter as 0 (zero), the stored procedure returns the following parameters for a non-data sharing system in a Version 2.0 XML output document by default:
  • DB2 Subsystem Status Information
  • DB2 Subsystem Parameters
  • DB2 Distributed Access Information
  • Active Log Data Set Information
  • Time of Last DB2 Restart
  • Resource Limit Facility Information
  • Connected DB2 Subsystem
For a data sharing system, the same information is returned for each member of a data sharing group, plus the Common Data Sharing Group Information parameter.
If you passed a Version 2.0 XML input document to the stored procedure, the stored procedure returns the information in a Version 2.0 XML output document. The information returned is dependent on what you specified in the Include array and in the DB2 Data Sharing Group Members array (if applicable). For a non-data sharing system, the items that are specified in the Include array are returned. For a data sharing system, the following information is returned:
  • The items that are specified in the Include array for each DB2 member that is specified in the DB2 Data Sharing Group Members array, if both the Include parameter and the DB2 Data Sharing Group Members parameter are specified.
  • The items that are specified in the Include array for every DB2 member in the data sharing group, if only the Include parameter is specified.
  • The Common Data Sharing Group Information and the following items for each member that is specified in the DB2 Data Sharing Group Members array, if only the DB2 Data Sharing Group Members parameter is specified:
    • DB2 Subsystem Status Information
    • DB2 Subsystem Parameters
    • DB2 Distributed Access Information
    • Active Log Data Set Information
    • Time of Last DB2 Restart
    • Resource Limit Facility Information
    • Connected DB2 Subsystem
Note: If the Common Data Sharing Group Information item is specified in the Include array, this information is returned only once for the data sharing group. This information is not returned repeatedly for every DB2 member that is processed.

Complete mode: For an example of a Version 2.0 XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode in a non-data sharing system, see Example 4 in the Examples section. For an example of a Version 2.0 XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode in a data sharing system with two DB2 members, DB2A and DB2B, see Example 5.

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 Configuration 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 2.0 XML output document depending on the major_version and minor_version parameters that you specify. For information about the content of a Version 2.0 XML output document, see the option description for the xml_input parameter.

For a sample Version 1.0 XML output document, see Example 1 in the Examples section.

For a sample Version 2.0 XML output document in a non-data sharing system, see Example 6.

For a sample Version 2.0 XML output document in a data sharing system, see Example 7.

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 an SQL warning condition. This document is returned when a call to the stored procedure results in an 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 2.0 XML message document depending on the major_version and minor_version parameters that you specify.

For an example of an XML message document, see Example 2.

If the GET_CONFIG stored procedure is processing more than one DB2 member in a data sharing system and an error is encountered when processing one of the DB2 members, the stored procedure specifies the name of the DB2 member that is causing the error as the value of the DB2 Object key in the XML message document. The value of the Short Message Text key applies to the DB2 member that is specified.

The following example shows a fragment of a Version 2.0 XML message document with the DB2 Object key specified:
<key>Short Message Text</key> 
  <dict>
     <key>Display Name</key>
     <string>Short Message Text</string>
     <key>Value</key>
     <string>DSNA6xxI DSNADMGC .....</string>
     <key>DB2 Object</key>
     <string>DB2B</string>
     <key>Hint</key>
     <string />
  </dict>

Examples

Example 1: The following example shows a fragment of a Version 1.0 XML output document for the GET_CONFIG stored procedure for a data sharing member. For a non-data sharing member, the following entries in the DB2 Distributed Access Information item are not included: Resynchronization Domain, Alias List, Member IPv4 Address, Member IPv6 Address, and Location Server List.

The two major sections that the XML output document always contains are Common Data Sharing Group Information and DB2 Subsystem Specific Information. 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>DDF Status</string>
  <key>Value</key>
  <string>STARTD</string>
  <key>Hint</key>
  <string />
</dict>
Start of change
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
  <key>Document Type Name</key>
  <string>Data Server Configuration Output</string>
  <key>Document Type Major Version</key>
  <integer>1</integer>
  <key>Document Type Minor Version</key>
  <integer>0</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>Common Data Sharing Group Information</key>
  <dict>
    <key>Display Name</key>
    <string>Common Data Sharing Group Information</string>
    <key>Data Sharing Group Name</key>
    ...
    <key>Data Sharing Group Level</key>
    ...
    <key>Data Sharing Group Mode</key>
    ...
    <key>Data Sharing Group Protocol Level</key>
    ...
    <key>Data Sharing Group Attach Name</key>
    ...
    <key>SCA Structure Size</key>
    ...
    <key>SCA Status</key>
    ...
    <key>SCA in Use</key>
    ...
    <key>LOCK1 Structure Size</key>
    ...
    <key>Number of Lock Entries</key>
    ...
    <key>Number of List Entries</key>
    ...
    <key>List Entries in Use</key>
    ...
    <key>Hint</key><string></string>
  </dict>

  <key>DB2 Subsystem Specific Information</key>
  <dict>
    <key>Display Name</key>
    <string>DB2 Subsystem Specific Information</string>
    <key>V91A</key>
    <dict>
      <key>Display Name</key>
      <string>V91A</string>
      <key>DB2 Subsystem Status Information</key>
      <dict>
        <key>Display Name</key>
        <string>DB2 Subsystem Status Information</string>
        <key>DB2 Member Identifier</key>
        ...
        <key>DB2 Member Name</key>
        ...
        <key>DB2 Command Prefix</key>
        ...
        <key>DB2 Status</key>
        ...
        <key>DB2 System Level</key>
        ...
        <key>System Name</key>
        ...
        <key>IRLM Subsystem Name</key>
        ...
        <key>IRLM Procedure Name</key>
        ...
        <key>Parallel Coordinator</key>
        ...
        <key>Parallel Assistant</key>
        ...
        <key>Hint</key><string></string>
      </dict>
      
      <key>DB2 Subsystem Parameters</key>
      <dict>
        <key>Display Name</key>
        <string>DB2 Subsystem Parameters</string>
        <key>DSNHDECP</key>
        <dict>
          <key>Display Name</key>
          <string>DSNHDECP</string>
          <key>AGCCSID</key>
          <dict>
            <key>Display Name</key>
            <string>AGCCSID</string>
            <key>Installation Panel Name</key>
            ...
            <key>Installation Panel Field Name</key>
            ...
            <key>Location on Installation Panel</key>
            ...
            <key>Subsystem Parameter Value</key>
            ...
            <key>Online Update</key>
            ...
            <key>Hint</key><string></string>
          </dict>
          
          --- This is only a fragment of the 
             DSNHDECP parameters that are returned 
             by the GET_CONFIG stored procedure. ---
          
          <key>Hint</key><string></string>
        </dict>

        --- This is only a fragment of the 
             DB2 subsystem parameters that are returned 
             by the GET_CONFIG stored procedure. ---

        <key>Hint</key><string></string>
      </dict>

      <key>DB2 Distributed Access Information</key>
      <dict>
        <key>Display Name</key>
        <string>DB2 Distributed Access Information</string>
        <key>DDF Status</key>
        ...
        <key>Location Name</key>
        ...
        <key>LU Name</key>
        ...
        <key>Generic LU Name</key>
        ...
        <key>TCP/IP Port</key>
        ...
        <key>Secure Port</key>
        ...
        <key>Resynchronization Port</key>
        ...
        <key>IP Name</key>
        ...
        <key>IPv4 Address</key>
        ...
        <key>IPv6 Address</key>
        ...
        <key>SQL Domain</key>
        ...
        <key>Resynchronization Domain</key>
        ...
        <key>Alias List</key>           
        <dict>                          
           <key>Display Name</key>      
           <string>Alias List</string>  
           <key>1</key>                 
           <dict>                       
              <key>Display Name</key>   
              <string>1</string>        
              <key>Name</key> 
              ...       
              <key>Port</key> 
              ...       
              <key>Secure Port</key> 
              ...
              <key>Hint</key><string /> 
           </dict>                      
           <key>2</key>                 
           <dict>                       
              <key>Display Name</key>   
              <string>2</string>        
              <key>Name</key> 
              ...       
              <key>Port</key> 
              ...       
              <key>Secure Port</key> 
              ...
              <key>Hint</key><string />
           </dict>                          
           <key>Hint</key><string />        
        </dict>                             
        <key>Member IPv4 Address</key> 
        ...  
        <key>Member IPv6 Address</key>
        ...
        <key>DT - DDF Thread Value</key>
        ...
        <key>CONDBAT - Maximum Inbound Connections</key>
        ...
        <key>MDBAT - Maximum Concurrent Active DBATs</key>
        ...
        <key>ADBAT - Active DBATs</key>
        ...
        <key>QUEDBAT - Times that ADBAT Reached MDBAT Limit</key>
        ...
        <key>INADBAT - Inactive DBATs (Type 1)</key>
        ...
        <key>CONQUED - Queued Connections</key>
        ...
        <key>DSCDBAT - Pooled DBATs</key>
        ...
        <key>INACONN - Inactive Connections (Type 2)</key>
        ...
        <key>Location Server List</key>                       
        <dict>                                                
           <key>Display Name</key>                            
           <string>Location Server List</string>              
           <key>1</key>                                       
           <dict>                                             
              <key>Display Name</key>                         
              <string>1</string>                              
              <key>Weight</key>
              ...                           
              <key>IPv4 Address</key> 
              ...                     
              <key>IPv6 Address</key> 
              ...                     
              <key>Hint</key><string />                       
           </dict> 
           <key>2</key>                                       
           <dict>                                             
              <key>Display Name</key>                         
              <string>2</string>                              
              <key>Weight</key> 
              ...                           
              <key>IPv4 Address</key> 
              ...                     
              <key>IPv6 Address</key> 
              ...                     
              <key>Hint</key><string />                       
           </dict>
           <key>Hint</key><string></string>  
        </dict> 
        <key>Hint</key><string></string>
      </dict>
 
      <key>Active Log Data Set Information</key>
      <dict>
        <key>Display Name</key>
        <string>Active Log Data Set Information</string>
        <key>Active Log Copy 01</key>
        <dict>
          <key>Display Name</key>
          <string>Active Log Copy 01</string>
          <key>Data Set Name</key>
          ...
          <key>Data Set Volumes</key>
          <dict>
            <key>Display Name</key>
            <string>Data Set Volumes</string>
            <key>Value</key>
            <array>
              <string>CATLGJ</string>
            </array>
            <key>Hint</key><string></string>
          </dict>
          <key>Hint</key><string></string>
        </dict>
        <key>Active Log Copy 02</key>
        <dict>
          --- The format of this dictionary entry is 
             the same as that of Active Log Copy 01. ---
        </dict>
        <key>Hint</key><string></string>
      </dict>
 
      <key>Time of Last DB2 Restart</key>
      ...
 
      <key>Resource Limit Facility Information</key>
      <dict>
        <key>Display Name</key>
        <string>Resource Limit Facility Information</string>
        <key>RLF Table Names</key>
        <dict>
          <key>Display Name</key>
          <string>RLF Table Names</string>
          <key>Value</key>
          <array>
            <string>SYSADM.DSNRLST01</string>
          </array>
          <key>Hint</key><string></string>
        </dict>
        <key>Hint</key><string></string>
      </dict>
 
      <key>Connected DB2 Subsystem</key>
      ...
      <key>Hint</key><string></string>
    </dict>
    <key>Hint</key><string></string>
  </dict>
  <key>Hint</key><string></string>
</dict>
</plist>
End of change
Example 2: The following example shows a sample XML message document for the GET_CONFIG stored procedure. Similar to an XML output document, the details about an SQL warning condition are 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>0</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>DSNA630I DSNADMGC A PARAMETER FORMAT OR CONTENT ERROR WAS FOUND. 
                The XML input document must be empty or NULL.</string> 
        <key>Hint</key><string /> 
     </dict>
  </dict>
  </plist>
Example 3: This example shows a simple and static Java program that calls the GET_CONFIG stored procedure with an XPath that queries the value of the data server's IP address. 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 GetConfDriver class resides.
//***************************************************************************
// Licensed Materials - Property of IBM
// 5635-DB2
// (C) COPYRIGHT 1982, 2006 IBM Corp. All Rights Reserved.
//
// STATUS = Version 9
//***************************************************************************
// Source file name: GetConfDriver.java
//
// Sample: How to call SYSPROC.GET_CONFIG with a valid XPath to extract the
// IP Address.
//
//The user runs the program by issuing:
//java GetConfDriver <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 GetConfDriver
{

   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: GetConfDriver <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 {

      byte[] xml_input;
      String str_xmlfilter = new String(
       "/plist/dict/key[.='DB2 Subsystem Specific Information']/following-
sibling::dict[1]" +
       "/key[.='V91A']/following-sibling::dict[1]" +
       "/key[.='DB2 Distributed Access Information']/following-sibling::dict[1]" +
       "/key[.='IP Address']/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");

      // 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_CONFIG(?,?,?,?,?,?,?)");

      // Major / Minor Version / Requested Locale
      cstmt.setInt(1, 1);
      cstmt.setInt(2, 0);
      cstmt.setString(3, "en_US");
      // No Input document
      cstmt.setObject(4, null, 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 into FileOutputStream */
        FileOutputStream fxml_out = new FileOutputStream("xml_output.xml");

        /* write byte array content into FileOutputStream */
        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(); }
    }
  }
}
Example 4: The following example shows a Version 2.0 XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode in a non-data sharing system:
  <plist version="1.0"> 
  <?xml version="1.0" encoding="UTF-8" ?>  
  <dict> 
    <key>Document Type Name</key> 
    <string>Data Server Configuration Input</string> 
    <key>Document Type Major Version</key> 
    <integer>2</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>Include</key> 
      <dict> 
        <key>Display Name</key> 
        <string>Include</string> 
        <key>Value</key> 
        <array> 
          <string>DB2 Subsystem Status Information</string> 
          <string>DB2 Subsystem Parameters</string> 
          <string>DB2 Distributed Access Information</string> 
          <string>Active Log Data Set Information</string> 
          <string>Time of Last DB2 Restart</string> 
          <string>Resource Limit Facility Information</string> 
          <string>Connected DB2 Subsystem</string>
        </array>  
        <key>Hint</key><string /> 
      </dict>  
      <key>Hint</key><string />
    </dict> 
  </dict> 
  </plist>
Example 5: The following example shows a Version 2.0 XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode in a data sharing system with two DB2 members, DB2A and DB2B:
  <plist version="1.0"> 
  <?xml version="1.0" encoding="UTF-8" ?> 
  <dict>     
    <key>Document Type Name</key>
    <string>Data Server Configuration Input</string>   
    <key>Document Type Major Version</key>     
    <integer>2</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>Include</key>  
      <dict>        
        <key>Display Name</key>   
        <string>Include</string>   
        <key>Value</key>     
        <array>       
          <string>Common Data Sharing Group Information</string> 
          <string>DB2 Subsystem Status Information</string>  
          <string>DB2 Subsystem Parameters</string>     
          <string>DB2 Distributed Access Information</string>  
          <string>Active Log Data Set Information</string>  
          <string>Time of Last DB2 Restart</string>  
          <string>Resource Limit Facility Information</string> 
          <string>Connected DB2 Subsystem</string>   
        </array>           
        <key>Hint</key><string />     
      </dict>     
      <key>DB2 Data Sharing Group Members</key>    
      <dict>                  
        <key>Display Name</key>   
        <string>DB2 Data Sharing Group Members</string> 
        <key>Value</key>    
        <array>      
          <string>DB2A</string>     
          <string>DB2B</string>      
        </array>            
        <key>Hint</key><string /> 
      </dict>      
      <key>Hint</key><string />     
     </dict>      
  </dict>       
  </plist>
Example 6: This example shows a fragment of a Version 2.0 XML output document for the GET_CONFIG stored procedure in a non-data sharing system. An XML input document is not passed to the stored procedure. The ellipsis (. . .) represent a dictionary entry that is comprised of Display Name, Value, and Hint, as in the following example, or an entry that is the same as the corresponding entry in a Version 1.0 XML output document:
<dict>
  <key>Display Name</key>
  <string>DDF Status</string>
  <key>Value</key>
  <string>STARTD</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 Configuration Output</string>                           
    <key>Document Type Major Version</key>                                      
    <integer>2</integer>                                                        
    <key>Document Type Minor Version</key>                                      
    <integer>0</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>DB2 Subsystem Specific Information</key>                               
    <dict>                                                                      
      <key>Display Name</key>                                                   
      <string>DB2 Subsystem Specific Information</string>                       
      <key>V91A</key>                                                           
      <dict>                                                                    
        <key>Display Name</key>                                                 
        <string>V91A</string>                                                   
        <key>DB2 Subsystem Status Information</key>                             
        <dict>...</dict>                                                        
        <key>DB2 Subsystem Parameters</key>                                     
        <dict>...</dict>                                                        
        <key>DB2 Distributed Access Information</key>                           
        <dict>                                                                  
          <key>Display Name</key>                                               
          <string>DB2 Distributed Access Information</string>                   
          <key>DDF Status</key> ...                                             
          <key>Location Name</key> ...                                          
          <key>LU Name</key> ...                                                
          <key>Generic LU Name</key> ...                                        
          <key>TCP/IP Port</key> ...                                            
          <key>Secure Port</key> ...                                            
          <key>Resynchronization Port</key> ...                                 
          <key>IP Name</key> ...                                                
          <key>IPv4 Address</key> ...                                           
          <key>IPv6 Address</key> ...                                           
          <key>SQL Domain</key> ...                                             
          <key>DT - DDF Thread Value</key> ...                                  
          <key>CONDBAT - Maximum Inbound Connections</key> ...                  
          <key>MDBAT - Maximum Concurrent Active DBATs</key> ...                
          <key>ADBAT - Active DBATs</key> ...                                   
          <key>QUEDBAT - Times that ADBAT Reached MDBAT Limit</key> ...         
          <key>INADBAT - Inactive DBATs (Type 1)</key> ...                      
          <key>CONQUED - Queued Connections</key> ...                           
          <key>DSCDBAT - Pooled DBATs</key> ...                                 
          <key>INACONN - Inactive Connections (Type 2)</key> ...                
          <key>Hint</key><string></string>                                      
        </dict>                                                                 
        <key>Active Log Data Set Information</key>                              
        <dict>...</dict>                                                        
        <key>Time of Last DB2 Restart</key>                                     
        <dict>...</dict>                                                        
        <key>Resource Limit Facility Information</key>                          
        <dict>                                                                  
          <key>Display Name</key>                                               
          <string>Resource Limit Facility Information</string>                  
          <key>RLF Status</key>                                                 
          <dict>                                                                
             <key>Display Name</key>                                            
             <string>RLF Status</string>                                        
             <key>Value</key><string>Active</string>                            
             <key>Hint</key><string />                                          
          </dict>                                                               
          <key>RLF Table Names</key>                                            
          <dict>                                                                
             <key>Display Name</key>                                            
             <string>RLF Table Names</string>                                   
             <key>Value</key>                                                   
             <array>                                                            
                <string>SYSADM.DSNRLST01</string>                               
             </array>                                                           
             <key>Hint</key><string />                                          
          </dict>                                                               
          <key>Hint</key><string />                                             
        </dict>                                                                 
        <key>Connected DB2 Subsystem</key>                                      
        <dict>...</dict>                                                        
        <key>Hint</key><string />                                               
      </dict>                                                                   
      <key>Hint</key><string />                                                 
    </dict>                                                                     
  </dict>                                                                       
  </plist>
Example 7: This example shows a fragment of a Version 2.0 XML output document for the GET_CONFIG stored procedure in a data sharing system with two DB2 members, DB2A and DB2B. An XML input document is not passed to the stored procedure. The ellipsis (. . .) represent a dictionary entry that is comprised of Display Name, Value, and Hint, as in the following example, or an entry that is the same as the corresponding entry in a Version 1.0 XML output document:
<dict>
  <key>Display Name</key>
  <string>DDF Status</string>
  <key>Value</key>
  <string>STARTD</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 Configuration Output</string>                           
    <key>Document Type Major Version</key>                                      
    <integer>2</integer>                                                        
    <key>Document Type Minor Version</key>                                      
    <integer>0</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>Common Data Sharing Group Information</key>                            
    <dict>                                                                      
      <key>Display Name</key>                                                   
      <string>Common Data Sharing Group Information</string>                    
      <key>Data Sharing Group Name</key>                                        
      <dict>...</dict>                                                          
      <key>Data Sharing Group Level</key>                                       
      <dict>...</dict>                                                          
      <key>Data Sharing Group Mode</key>                                       
      <dict>...</dict>                                                          
      <key>Data Sharing Group Protocol Level</key>                              
      <dict>...</dict>                                                          
      <key>Data Sharing Group Attach Name</key>                                 
      <dict>...</dict>                                                          
      <key>SCA Structure Size</key>                                             
      <dict>...</dict>                                                          
      <key>SCA Status</key>                                                     
      <dict>...</dict>                                                          
      <key>SCA in Use</key>                                                     
      <dict>...</dict>                                                          
      <key>LOCK1 Structure Size</key>                                           
      <dict>...</dict>                                                          
      <key>Number of Lock Entries</key>                                         
      <dict>...</dict>                                                          
      <key>Number of List Entries</key>                                         
      <dict>...</dict>                                                          
      <key>List Entries in Use</key>                                            
      <dict>...</dict>                                                          
      <key>Hint</key><string />                                                 
    </dict>                                                                     
    <key>DB2 Subsystem Specific Information</key>                               
    <dict>                                                                      
      <key>Display Name</key>                                                   
      <string>DB2 Subsystem Specific Information</string>                       
      <key>DB2A</key>                                                           
      <dict>                                                                    
        <key>Display Name</key>                                                 
        <string>DB2A</string>                                                   
        <key>DB2 Subsystem Status Information</key>                             
        <dict>...</dict>                                                        
        <key>DB2 Subsystem Parameters</key>                                     
        <dict>...</dict>                                                        
        <key>DB2 Distributed Access Information</key>                           
        <dict>                                                                  
          <key>Display Name</key>                                               
          <string>DB2 Distributed Access Information</string>                   
          <key>DDF Status</key> ...                                             
          <key>Location Name</key> ...                                          
          <key>LU Name</key> ...                                                
          <key>Generic LU Name</key> ...                                        
          <key>TCP/IP Port</key> ...                                            
          <key>Secure Port</key> ...                                            
          <key>Resynchronization Port</key> ...                                 
          <key>IP Name</key> ...                                                
          <key>IPv4 Address</key> ...                                           
          <key>IPv6 Address</key> ...                                           
          <key>SQL Domain</key> ...                                             
          <key>Resynchronization Domain</key> ...                               
          <key>Alias List</key>                                                 
          <dict>                                                                
             <key>Display Name</key>                                            
             <string>Alias List</string>                                        
             <key>1</key>                                                       
             <dict>                                                             
                <key>Display Name</key>                                         
                <string>1</string>                                              
                <key>Name</key> ...                                             
                <key>Port</key> ...                                             
                <key>Secure Port</key> ...                                      
                <key>Hint</key><string />                                       
             </dict>                                                            
             <key>2</key>                                                       
             <dict>                                                             
                <key>Display Name</key>                                         
                <string>2</string>                                              
                <key>Name</key> ...                                             
                <key>Port</key> ...                                             
                <key>Secure Port</key> ...                                      
                <key>Hint</key><string />                                       
             </dict>                                                            
             <key>Hint</key><string />                                          
          </dict>                                                               
          <key>Member IPv4 Address</key> ...                                    
          <key>Member IPv6 Address</key> ...                                    
          <key>DT - DDF Thread Value</key> ...                                  
          <key>CONDBAT - Maximum Inbound Connections</key> ...                  
          <key>MDBAT - Maximum Concurrent Active DBATs</key> ...                
          <key>ADBAT - Active DBATs</key> ...                                   
          <key>QUEDBAT - Times that ADBAT Reached MDBAT Limit</key> ... 
          <key>INADBAT - Inactive DBATs (Type 1)</key> ...                      
          <key>CONQUED - Queued Connections</key> ...                           
          <key>DSCDBAT - Pooled DBATs</key> ...                                 
          <key>INACONN - Inactive Connections (Type 2)</key> ...                
          <key>Location Server List</key>                                       
          <dict>                                                                
             <key>Display Name</key>                                            
             <string>Location Server List</string>                              
             <key>1</key>                                                       
             <dict>                                                             
                <key>Display Name</key>                                         
                <string>1</string>                                              
                <key>Weight</key> ...                                           
                <key>IPv4 Address</key> ...                                     
                <key>IPv6 Address</key> ...                                     
                <key>Hint</key><string />                                       
             </dict>                                                            
             <key>2</key>                                                       
             <dict>                                                             
                <key>Display Name</key>                                         
                <string>1</string>                                              
                <key>Weight</key> ...                                           
                <key>IPv4 Address</key> ...                                     
                <key>IPv6 Address</key> ...                                     
                <key>Hint</key><string />                                       
             </dict>                                                            
             <key>Hint</key><string />                                          
          </dict>                                                               
          <key>Hint</key><string></string>                                      
        </dict>                                                                 
        <key>Active Log Data Set Information</key>                              
        <dict>...</dict>                                                        
        <key>Time of Last DB2 Restart</key>                                     
        <dict>...</dict>                                                        
        <key>Resource Limit Facility Information</key>                          
        <dict>                                                                  
          <key>Display Name</key>                                               
          <string>Resource Limit Facility Information</string>                  
          <key>RLF Status</key>                                                 
          <dict>                                                                
             <key>Display Name</key>                                            
             <string>RLF Status</string>                                        
             <key>Value</key><string>Active</string>                            
             <key>Hint</key><string />                                          
          </dict>                                                               
          <key>RLF Table Names</key>                                            
          <dict>                                                                
             <key>Display Name</key>                                            
             <string>RLF Table Names</string>                                   
             <key>Value</key>                                                   
             <array>                                                            
                <string>SYSADM.DSNRLST01</string>                               
             </array>                                                           
             <key>Hint</key><string />                                          
          </dict>                                                               
          <key>Hint</key><string />                                             
        </dict>                                                                 
        <key>Connected DB2 Subsystem</key>                                      
        <dict>...</dict>                                                        
        <key>Hint</key><string />                                               
      </dict>                                                                   
      <key>DB2B</key>                                                           
      <dict>                                                                    
         --- This dictionary entry describes the second DB2                     
             member: DB2B. Its format is the same as that                   
             of member DB2A. ---                                          
      </dict>                                                                   
      <key>Hint</key><string />                                                 
    </dict>                                                                     
  </dict>                                                                       
  </plist>

End general-use programming interface information.