<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://m204wiki.rocketsoftware.com/index.php?action=history&amp;feed=atom&amp;title=UL%2FDB2_error_codes_and_messages</id>
	<title>UL/DB2 error codes and messages - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://m204wiki.rocketsoftware.com/index.php?action=history&amp;feed=atom&amp;title=UL%2FDB2_error_codes_and_messages"/>
	<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=UL/DB2_error_codes_and_messages&amp;action=history"/>
	<updated>2026-05-10T22:10:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=UL/DB2_error_codes_and_messages&amp;diff=81804&amp;oldid=prev</id>
		<title>Admin at 20:40, 25 November 2015</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=UL/DB2_error_codes_and_messages&amp;diff=81804&amp;oldid=prev"/>
		<updated>2015-11-25T20:40:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:40, 25 November 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l86&quot;&gt;Line 86:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    PRINT $DB2EMSG&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    PRINT $DB2EMSG&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;END IF&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;END IF&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==See also==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Template:UL/DB2 topic list}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: UL/DB2]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: UL/DB2]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://m204wiki.rocketsoftware.com/index.php?title=UL/DB2_error_codes_and_messages&amp;diff=78616&amp;oldid=prev</id>
		<title>ELowell: Created page with &quot;&lt;p&gt;This topic describes how to interpret the return codes and messages returned by the User Language/DATABASE 2 Interface.&lt;/p&gt;  ===UL/DB2 error processing=== &lt;p&gt; When a UL/DB2...&quot;</title>
		<link rel="alternate" type="text/html" href="https://m204wiki.rocketsoftware.com/index.php?title=UL/DB2_error_codes_and_messages&amp;diff=78616&amp;oldid=prev"/>
		<updated>2015-07-28T20:54:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;p&amp;gt;This topic describes how to interpret the return codes and messages returned by the User Language/DATABASE 2 Interface.&amp;lt;/p&amp;gt;  ===UL/DB2 error processing=== &amp;lt;p&amp;gt; When a UL/DB2...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;p&amp;gt;This topic describes how to interpret the return codes and messages returned by the User Language/DATABASE 2 Interface.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===UL/DB2 error processing===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When a UL/DB2 statement executes, UL/DB2 sets status information that indicates whether the statement completed normally. UL/DB2 communicates this status information through the User Language $STATUS and $STATUSD functions. UL/DB2 communicates the error message associated with an abnormal status code through the $ERRMSG function for Call Attach Facility (CAF) calls, and the $DB2EMSG function for SQL statements.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using tracing===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
UL/DB2 error processing is handled by CAF. If you allocate a DSNTRACE data set for the job, CAF sends diagnostic messages to the DSNTRACE data set.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Typically, you do not want to turn DSNTRACE on. If you turn DSNTRACE on and have multiple users, you might get a S013E ABEND. This is an IBM problem that is caused by DSNTRACE not being able to work with multiple tasks. There is an APAR -- a suggestion for IBM to fix the problem.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Turn DSNTRACE on only when debugging in a single user environment. To turn DSNTRACE on, add a DD card to the startup JCL.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
See the &amp;lt;var class=&amp;quot;book&amp;quot;&amp;gt;IBM DATABASE 2 Call Attach Facility User&amp;#039;s Guide and Reference&amp;lt;/var&amp;gt; for more information.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Errors involving Call Attach Facility calls==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This section describes the diagnostic information returned by UL/DB2 when there is an error that involves a CAF call. The CAF calls that you can use in a User Language procedure are:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;CONNECT TO&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;DISCONNECT FROM&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===$STATUS and $STATUSD===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When there is an error involving a CAF call, CAF places a return code in R15, and a reason code in R0. $STATUS retrieves the return code, the contents of R15, after each CAF call. A value of one ($STATUS=1) or greater indicates that an error occurred and identifies the error as belonging to a particular category.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the return code does not equal zero ($STATUS NE 0), then $STATUSD retrieves the reason code (the contents of R0). $STATUSD indicates the specific error condition within a particular $STATUS category.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
[[#Common return and reason codes|Common return and reason codes]] lists some of the more common return and reason codes. You can find a complete list of reason and return codes in the &amp;lt;var class=&amp;quot;book&amp;quot;&amp;gt;IBM DATABASE 2 Call Attach Facility User&amp;#039;s Guide and Reference&amp;lt;/var&amp;gt;, and the &amp;lt;var class=&amp;quot;book&amp;quot;&amp;gt;IBM DATABASE 2 Messages and Codes Manual&amp;lt;/var&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If the return code is equal to zero ($STATUS = 0), $STATUSD returns unpredictable codes.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===$ERRMSG===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Use the User Language $ERRMSG function to retrieve the error message for an error with a CAF call, that is, CONNECT TO or DISCONNECT FROM. The string returned by $ERRMSG can be up to 80 characters long.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p class=&amp;quot;caption&amp;quot; style=&amp;quot;width:468px&amp;quot;&amp;gt;Common return and reason codes&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;figure&amp;quot;&amp;gt;[[File:ULDB2_ch4_reason_codes.gif]] &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Example=====&lt;br /&gt;
&amp;lt;p&amp;gt;The following code fragment shows how you can test the value of $STATUS after a CAF call:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;EXEC DB2&lt;br /&gt;
   CONNECT TO BOSTON&lt;br /&gt;
END EXEC&lt;br /&gt;
IF $STATUS NE 0 THEN&lt;br /&gt;
   PRINT &amp;#039; $STATUS=&amp;#039; AND $STATUS&lt;br /&gt;
   PRINT &amp;#039;$STATUSD=&amp;#039; AND $STATUSD&lt;br /&gt;
   PRINT $ERRMSG&lt;br /&gt;
JUMP TO FINI:&lt;br /&gt;
END IF&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Errors involving SQL statements==&lt;br /&gt;
&amp;lt;p&amp;gt;This section describes the diagnostic information returned by UL/DB2 when there is an error involving an SQL statement.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using the $STATUS and $STATUSD functions===&lt;br /&gt;
&amp;lt;p&amp;gt;After invoking an SQL statement, $STATUS indicates whether an error occurred processing the statement. If no errors occurred, $STATUS is equal to zero. If an error occurred, $STATUS is not equal to zero and the value of STATUSD contains more specific information about the error.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
When DB2 executes an SQL statement, it places the SQL return code in the SQLCODE field of the SQL Communication Area (SQLCA). $STATUSD retrieves the value of the SQLCODE field after an SQL statement. Typically, a negative SQL return code indicates an error, a positive return code indicates an exceptional but valid condition, and zero indicates successful execution.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; In one special case, $STATUS has the same value as SQLCODE. A $STATUS of 100 indicates table empty or completed; in this case, $STATUSD, which contains SQLCODE, is also 100.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Understanding the $DB2EMSG function===&lt;br /&gt;
&amp;lt;p&amp;gt;If the SQL return code does not equal zero (SQLCODE NE 0), then DB2 also returns tokens in the SQLCA. UL/DB2 processes the tokens internally, and returns them using $DB2EMSG. The string returned by $DB2EMSG can be up to 240 characters long.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For example, attempting to access a column that does not exist returns an SQLCA with the SQLCODE set to -205, and SQLERRM contains two tokens: the column name and the table name. Looking up the SQLCODE in the &amp;lt;var class=&amp;quot;book&amp;quot;&amp;gt;DATABASE 2 Messages and Codes Manual&amp;lt;/var&amp;gt; gives the following error message:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;-205	&amp;lt;var class=&amp;quot;term&amp;quot;&amp;gt;column-name&amp;lt;/var&amp;gt; IS NOT A COLUMN OF TABLE &amp;lt;var class=&amp;quot;term&amp;quot;&amp;gt;table-name&amp;lt;/var&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Retrieving the value of $DB2EMSG returns:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;DSNT408I SQLCODE = -205, ERROR: FOO IS NOT A COLUMN OF TABLE M204.BAR&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
(This example assumes that DB2 contains table M204.BAR, which does not contain column FOO.)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
You can find all the SQL return codes in the &amp;lt;var class=&amp;quot;book&amp;quot;&amp;gt;IBM DATABASE 2 Messages and Codes Manual&amp;lt;/var&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
The following code fragment shows how you can test the value of $STATUS after executing an SQL statement:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;code&amp;quot;&amp;gt;EXEC DB2&lt;br /&gt;
   OPEN BAR&lt;br /&gt;
END EXEC&lt;br /&gt;
IF $STATUS NE 0 THEN&lt;br /&gt;
   PRINT &amp;#039; $STATUS=&amp;#039; AND $STATUS&lt;br /&gt;
   PRINT &amp;#039;$STATUSD=&amp;#039; AND $STATUSD&lt;br /&gt;
   PRINT $DB2EMSG&lt;br /&gt;
END IF&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category: UL/DB2]]&lt;/div&gt;</summary>
		<author><name>ELowell</name></author>
	</entry>
</feed>