GET_MESSAGE stored procedure
The GET_MESSAGE stored procedure returns the short message text for an SQLCODE.
The GET_MESSAGE stored procedure supports SBCS CCSID only. That is, all data (input and output) must exist in Unicode CCSID 367.
Support for Katakana CCSID 290 is limited. Any user-specific information specified in the xml_input document (such as the string input for SQLCODE and Message Tokens) must contain only valid EBCDIC CCSID 37 characters, and these EBCDIC characters must exist in Unicode CCSID 367. Likewise, any requested information that is converted to Unicode CCSID 367 and written to the xml_output document, must also contain only valid EBCDIC CCSID 37 characters, and these EBCDIC characters must exist in Unicode CCSID 367.
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_MESSAGE stored procedure.
Syntax
The following syntax diagram shows the SQL CALL statement for invoking this stored procedure:
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 stored procedure. To determine the highest supported document version, specify NULL for this input parameter and all other required parameters. Currently, the highest and only major document version that is supported is 1.
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 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 Message Input in UTF-8 that contains input values for the stored procedure.For this stored procedure, 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 Message 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>Required Parameters</key> <dict> <key>SQLCODE</key> <dict> <key>Value</key><integer>sqlcode</integer> </dict> </dict> <key>Optional Parameters</key> <dict> <key>Message Tokens</key> <dict> <key>Value</key> <array> <string>token1 in SQLCA</string> <string>token2 in SQLCA</string> </array> </dict> </dict> </dict> </plist>For an example of an XML input document that will not run in Complete mode, see Example 2.
Complete mode: For an example of an XML input document that is returned by the xml_output parameter when the stored procedure is running in Complete mode, see Example 1 in the Examples section.
- 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 short message text from the XML output document:
If the key is not followed by the specified sibling, an error is returned./plist/dict/key[.='Short Message Text']/following-sibling::dict[1]/key [.='Value']/following-sibling::string[1] - xml_output
- An output parameter of type BLOB(2G) that returns a complete XML output document of type Data Server Message 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.
For an example of an XML output document, see Example 3.
- 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 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.
For an example of an XML message document, see Example 4.
Example
- Example 1
- The following example shows an 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 Message 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>Required Parameters</key> <dict> <key>Display Name</key> <string>Required Parameters</string> <key>SQLCODE</key> <dict> <key>Display Name</key> <string>SQLCODE</string> <key>Value</key> <integer /> <key>Hint</key> <string /> </dict> <key>Hint</key> <string /> </dict> <key>Optional Parameters</key> <dict> <key>Display Name</key> <string>Optional Parameters</string> <key>Message Tokens</key> <dict> <key>Display Name</key> <string>Message Tokens</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 complete sample of an XML input document for the GET_MESSAGE stored procedure.
<?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> <key>Document Type Name</key> <string>Data Server Message 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>Required Parameters</key> <dict> <key>SQLCODE</key> <dict> <key>Value</key><integer>-104</integer> </dict> </dict> <key>Optional Parameters</key> <dict> <key>Message Tokens</key> <dict> <key>Value</key> <array> <string>X</string> <string>( . LIKE AS</string> </array> </dict> </dict> </dict> </plist> - Example 3
- The following example shows a complete sample of an XML output document for the GET_MESSAGE stored procedure. The short message text for an SQLCODE 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 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>Short Message Text</key> <dict> <key>Display Name</key><string>Short Message Text</string> <key>Hint</key><string /> </dict> </dict> </plist> - Example 4
- The following example shows a sample XML message document for the GET_MESSAGE 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>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 DSNADMGM A PARAMETER FORMAT OR CONTENT ERROR WAS FOUND. The value for key 'Document Type Minor Version' is '2'. It does not match the value '0', which was specified for parameter 2 of the stored procedure. Both values must be equal.</string> <key>Hint</key><string /> </dict> </dict> </plist> - Example 5
- This example shows a simple and static Java™ program that calls the GET_MESSAGE stored procedure with an XML input document and an XPath that queries the short message text of an SQLCODE.
