<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Rdb error does not make a VMS error in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366585#M41836</link>
    <description>I think the only thing that I would add is if you do end up wrapping commands up in a bit of DCL, then, if at all possible,  ASSUME that a failure has occured and check for a string to suggest success.&lt;BR /&gt;&lt;BR /&gt;Craig</description>
    <pubDate>Thu, 26 Feb 2009 15:32:31 GMT</pubDate>
    <dc:creator>Craig A</dc:creator>
    <dc:date>2009-02-26T15:32:31Z</dc:date>
    <item>
      <title>Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366577#M41828</link>
      <description>When a VMS/DCL script makes an (Oracle) Rdb database call (through MC SQL$), a severe error (SQL-F-...) in Rdb (wrong table name etc) will make the DCL script stop, but a normal error (SQL-E-...) in Rdb (trying to break unique constraint etc) will make the DCL script continue (same $STATUS as for a successful SQL statement). &lt;BR /&gt;&lt;BR /&gt;In other words: &lt;BR /&gt;Rdb success =&amp;gt; VMS success&lt;BR /&gt;Rdb error =&amp;gt; VMS success (!)&lt;BR /&gt;Rdb severe error =&amp;gt; VMS severe error&lt;BR /&gt;&lt;BR /&gt;How do I achieve "Rdb error =&amp;gt; VMS error" so that my script will see all kinds of errors that occur in the database? &lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 19:19:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366577#M41828</guid>
      <dc:creator>Flewdur</dc:creator>
      <dc:date>2009-02-25T19:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366578#M41829</link>
      <description>&lt;!--!*#--&gt;What is the command which leads to the&lt;BR /&gt;"normal error (SQL-E-...)"?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] same $STATUS [...]&lt;BR /&gt;&lt;BR /&gt;And that status value is ...?&lt;BR /&gt;&lt;BR /&gt;Sometimes, showing the actual commands and&lt;BR /&gt;their actual output can be more helpful than&lt;BR /&gt;vague descriptions.</description>
      <pubDate>Wed, 25 Feb 2009 19:29:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366578#M41829</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-02-25T19:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366579#M41830</link>
      <description>Sorry. &lt;BR /&gt;&lt;BR /&gt;Error example: &lt;BR /&gt;insert into my_table values (1, "Frank"); &lt;BR /&gt;(where this row already exists in the table, and there is a unique index on the numeric column)&lt;BR /&gt;=&amp;gt; calling DCL script keeps running&lt;BR /&gt;&lt;BR /&gt;Severe error example: &lt;BR /&gt;select * from my_ttable;&lt;BR /&gt;(spelling error on table name).&lt;BR /&gt;=&amp;gt; calling DCL script stops&lt;BR /&gt;&lt;BR /&gt;$STATUS value (checked in the first DCL statement after leaving Rdb) is %X10000001 for the error, as well as for a successful SQL statement. Same thing in interactive DCL/SQL. $SEVERITY was 1 in both cases. &lt;BR /&gt;&lt;BR /&gt;Can't remember the exact $STATUS value for the severe error, but it was something like %X0408A8D3 (made that up, but it was NOT a row of 0's). $SEVERITY was 4, I think. &lt;BR /&gt;&lt;BR /&gt;It says in the VMS manual somewhere (SQL programming, I think), that the VMS condition handler treats an Rdb severe error as an true error but an Rdb error as a success. &lt;BR /&gt;&lt;BR /&gt;So it works like this by design, but I thought there might be a workaround of some sort. My script would need to capture any errors in VMS no matter what the SQL statement is. &lt;BR /&gt;&lt;BR /&gt;My script (A.COM) is intended to work as a "host" script for other scripts that make changes in the Rdb database. Simplified:&lt;BR /&gt;&lt;BR /&gt;$! A.COM&lt;BR /&gt;$ ON ERROR GOTO FINISH&lt;BR /&gt;$ @B.COM  !WITH SQL STATEMENTS&lt;BR /&gt;$!&lt;BR /&gt;$ @C.COM  !WITH SQL STATEMENTS&lt;BR /&gt;$!&lt;BR /&gt;$ @D.COM  !WITH SQL STATEMENTS&lt;BR /&gt;$ FINISH:&lt;BR /&gt;$ EXIT&lt;BR /&gt;&lt;BR /&gt;I would like that an error in the B.COM SQL call would generate an error in B.COM and A.COM, so that C.COM and D.COM do not run. &lt;BR /&gt;&lt;BR /&gt;It doesn't help to move any checks to B.COM, C.COM etc, because the "damage" is done as soon as the Rdb error is "sent" to VMS. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 21:42:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366579#M41830</guid>
      <dc:creator>Flewdur</dc:creator>
      <dc:date>2009-02-25T21:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366580#M41831</link>
      <description>There's nothing you can do from VMS. If an image/program (here SQL) decides to exit with success after an error then that is what DCL receives.&lt;BR /&gt;&lt;BR /&gt;Didn't see a way to change that in Rdb/SQL.&lt;BR /&gt;&lt;BR /&gt;/Guenther</description>
      <pubDate>Wed, 25 Feb 2009 22:50:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366580#M41831</guid>
      <dc:creator>GuentherF</dc:creator>
      <dc:date>2009-02-25T22:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366581#M41832</link>
      <description>I haven't tried this, but I notice in the GET DIAGNOSTIC sql command, you do something like&lt;BR /&gt;&lt;BR /&gt;GET DIAGNOSTIC EXCEPTION RETURN SQLCODE&lt;BR /&gt;&lt;BR /&gt;so perhaps you could use this within your SQL script to check after the insert to see if a duplicate error was returned - and handle as needed.&lt;BR /&gt;&lt;BR /&gt;cheers,&lt;BR /&gt;chris&lt;BR /&gt;&lt;BR /&gt;P.S. This may depend what version of Rdb you are on...</description>
      <pubDate>Wed, 25 Feb 2009 23:35:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366581#M41832</guid>
      <dc:creator>Chris Barratt</dc:creator>
      <dc:date>2009-02-25T23:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366582#M41833</link>
      <description>The way I tend to solve these problems is like:&lt;BR /&gt;$ pipe mc sql$ select * from table; &amp;gt; test.txt&lt;BR /&gt;or like your example:&lt;BR /&gt;pipe mc sql$ @b.sql; &amp;gt; test.txt&lt;BR /&gt;$ search test.txt "-E-"&lt;BR /&gt;This isn't the neat way but it works.</description>
      <pubDate>Thu, 26 Feb 2009 07:11:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366582#M41833</guid>
      <dc:creator>Kees L.</dc:creator>
      <dc:date>2009-02-26T07:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366583#M41834</link>
      <description>I would capture the output and after each execution I would set the status myself based upon the contents of the file.&lt;BR /&gt;something like&lt;BR /&gt;&lt;BR /&gt;f=0&lt;BR /&gt;e=0&lt;BR /&gt;w=0&lt;BR /&gt;open&lt;BR /&gt;r: read x log_rcd&lt;BR /&gt;if f$loc("DUPLICATE KEY",log_rcd) .lt f$len(log_rcd) then w=1&lt;BR /&gt;if f$locate("xxx",log_rcd)  .lt f$len(log_rcd) then e=1&lt;BR /&gt;...&lt;BR /&gt;goto r&lt;BR /&gt;close&lt;BR /&gt;if f then exit 4&lt;BR /&gt;if e then exit 2&lt;BR /&gt;if w then exit 0&lt;BR /&gt;&lt;BR /&gt;This script will of course be alive because there are a lot of possibilities why something could go wrong. The alternative is to say that it goes fine if all lines contain known text and else it's wrong (so, only F).&lt;BR /&gt;&lt;BR /&gt;Wim&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2009 07:50:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366583#M41834</guid>
      <dc:creator>Wim Van den Wyngaert</dc:creator>
      <dc:date>2009-02-26T07:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366584#M41835</link>
      <description>&lt;!--!*#--&gt;Howdy,&lt;BR /&gt;&lt;BR /&gt;I create a temporary file with my sql statements, and have a "SET OUTPUT" statement in it.&lt;BR /&gt;&lt;BR /&gt;ie sql.tmp is:&lt;BR /&gt;&lt;BR /&gt;set output sql_read.out;&lt;BR /&gt;attach 'filename myrdb.rdb';&lt;BR /&gt;select time from record where value='12:00'&lt;BR /&gt;rollback;&lt;BR /&gt;disconnect all;&lt;BR /&gt;&lt;BR /&gt;Then run it:&lt;BR /&gt;$ sql @sql.tmp&lt;BR /&gt;&lt;BR /&gt;Then check sql_read.out for "-E-" or "-W-" or "-F-" as applicable&lt;BR /&gt;&lt;BR /&gt;A bit of playing about, but them's the delights of DCL...&lt;BR /&gt;&lt;BR /&gt;have fun,&lt;BR /&gt;&lt;BR /&gt;PJ</description>
      <pubDate>Thu, 26 Feb 2009 14:06:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366584#M41835</guid>
      <dc:creator>Paul Jerrom</dc:creator>
      <dc:date>2009-02-26T14:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366585#M41836</link>
      <description>I think the only thing that I would add is if you do end up wrapping commands up in a bit of DCL, then, if at all possible,  ASSUME that a failure has occured and check for a string to suggest success.&lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Thu, 26 Feb 2009 15:32:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366585#M41836</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2009-02-26T15:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366586#M41837</link>
      <description>The massive brute-force fix: don't use SQL commands directly.  Use your own embedded SQL commands within your own SQL tool images; the SQL$PRE stuff is fairly easy, all things considered.  You then have rather more control over the error handling.  This presumes you're not (also) assembling your own SQL commands on the fly, and that you have a fixed set of SQL commands of interest, whether with selectable search targets or not.</description>
      <pubDate>Thu, 26 Feb 2009 15:51:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366586#M41837</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-02-26T15:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366587#M41838</link>
      <description>Good advice Craig! &lt;BR /&gt;The absence of a recognized error message does not imply success.&lt;BR /&gt;&lt;BR /&gt;The presence of a success string like "xyz created" or "nnn records inserted" is much more convincing.&lt;BR /&gt;&lt;BR /&gt;If one were to parse SQL output for errors, then PERL of course offers a nice selection of string matching and reporting tools. For examples:&lt;BR /&gt;&lt;BR /&gt;# perl -ne "$e{$1}++ if /SQL-(.)-/} { for (keys %e) { print qq($_ : $e{$_}\n) }" sql_output.txt&lt;BR /&gt;F : 1&lt;BR /&gt;E : 2&lt;BR /&gt;&lt;BR /&gt;# perl -ne "$e{$1}++ if /SQL-(.)-/&lt;BR /&gt;} { &lt;BR /&gt;@codes=qw(F E W I); &lt;BR /&gt;for (@codes) { &lt;BR /&gt;if ($e{$_}) { print qq(Worst = $_\n); last}&lt;BR /&gt;} &lt;BR /&gt;print qq(no Errors found\n)" tmp.txt&lt;BR /&gt;&lt;BR /&gt;Worst = W&lt;BR /&gt;&lt;BR /&gt;I guess that part of the problem is that those 'normal errors', in some way of looking at it, are not errors. &lt;BR /&gt;SQL worked just fine. I found a dupiclate key and refused to enter it. It did exactly as requested. Success! No 'error' there.&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2009 16:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366587#M41838</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-02-26T16:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366588#M41839</link>
      <description>As previously suggested don't use directly SQL.&lt;BR /&gt;&lt;BR /&gt;Most of the time, when I have to do this, I wrote a small script like this Python example (probably can be done in PERL):&lt;BR /&gt;$ type foo.py ! space character used fo indentation replace by _ character because itrc remove all leading spaces&lt;BR /&gt;import sys, rdb&lt;BR /&gt;try:&lt;BR /&gt;____ rdb.attachDB('foo')&lt;BR /&gt;____ stm = rdb.Statement('select * from bar')&lt;BR /&gt;____ rdb.read_only()&lt;BR /&gt;____ stm.execute()&lt;BR /&gt;____ rdb.commit()&lt;BR /&gt;except Exception, e:&lt;BR /&gt;____ print e&lt;BR /&gt;____ sys.exit(44)&lt;BR /&gt;&lt;BR /&gt;$ python foo.py&lt;BR /&gt;(-1041, '%SQL-F-RELNOTDEF, Table BAR is not defined in database or schema', '42000')&lt;BR /&gt;%SYSTEM-F-ABORT, abort&lt;BR /&gt;$ sh sym $status&lt;BR /&gt;  $STATUS == "%X0000002C"&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;JF&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Feb 2009 07:17:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366588#M41839</guid>
      <dc:creator>Jean-François Piéronne</dc:creator>
      <dc:date>2009-02-27T07:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rdb error does not make a VMS error</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366589#M41840</link>
      <description>One thing to bear in mind is the old &lt;BR /&gt;%JBC-F-JOBABORT, job aborted during execution&lt;BR /&gt;exit message (This is where e bath job gets DELETE/ENTRY'ed)&lt;BR /&gt;&lt;BR /&gt;There is only a limited amount of time/rprocessing available when the error brancy is taken, so you need to work out what to do. &lt;BR /&gt;&lt;BR /&gt;Something I've used previously:&lt;BR /&gt;&lt;BR /&gt;$ set on&lt;BR /&gt;$ on error goto error&lt;BR /&gt;$! processing here&lt;BR /&gt;$ exit 1&lt;BR /&gt;$ error:&lt;BR /&gt;$ exit_status := '$status'&lt;BR /&gt;$ submit/nolog sys$manager:signal.com -&lt;BR /&gt;param=(procedure, exit_status)&lt;BR /&gt;&lt;BR /&gt;and then leave the signal.com to work out how to check for succes/failure and notify accordingly. &lt;BR /&gt;&lt;BR /&gt;It might be worth running some tests to see&lt;BR /&gt;whether this approach wioudfl be suitable. &lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Mon, 09 Mar 2009 13:27:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/rdb-error-does-not-make-a-vms-error/m-p/4366589#M41840</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2009-03-09T13:27:46Z</dc:date>
    </item>
  </channel>
</rss>

