<?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: Script error when executing in batch queue in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150399#M45113</link>
    <description>Mike,&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I see what you mean about the 2nd last line  being commented out, but&lt;BR /&gt;&amp;gt; correct me if I'm wrong in thinking that the file in question is just a&lt;BR /&gt;&amp;gt; record of the process id's stopped?&lt;BR /&gt;&lt;BR /&gt;No, you write the STOP commands to file TEMP.COM (and don't stop any process at this point). So you need to execute the file to get the STOP commands do their work. Just remove the "!" in fromt of that line.&lt;BR /&gt;&lt;BR /&gt;Hans.</description>
    <pubDate>Wed, 14 Jan 2009 23:53:23 GMT</pubDate>
    <dc:creator>H_Bachner</dc:creator>
    <dc:date>2009-01-14T23:53:23Z</dc:date>
    <item>
      <title>Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150392#M45106</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;I've been provided a script which needs to be run every day.  After researching this forum, I was able to schedule it via the batch queue like so:&lt;BR /&gt;&lt;BR /&gt;type DBLOCKCLEAN.COM&lt;BR /&gt;$ dblockclean = f$environment("PROCEDURE")&lt;BR /&gt;$ SUBMIT 'dblockclean' -&lt;BR /&gt;     /AFTER="TOMORROW+19:30"/NOPRINT/KEEP -&lt;BR /&gt;     /NAME=dsa0 [backup.lockcheck]dvaxkillsuts.com -&lt;BR /&gt;     /log=dsa0:[backup.lockcheck]dblockclean.log&lt;BR /&gt;&lt;BR /&gt;This seemed to work as it placed dvaxkillsuts.com into the batch queue as I wanted.  &lt;BR /&gt;Problem is, when it executes at 1930, it doesn't kill the open sessions as it needs to.&lt;BR /&gt;&lt;BR /&gt;When we run this script manually, it kills the active database sessions - when it runs via the batch queue, it does not.&lt;BR /&gt;Am I doing something wrong with how I submit this job to the queue?  A problem in the script itself?&lt;BR /&gt;I'd be grateful for any insight!&lt;BR /&gt;&lt;BR /&gt;Here is the script that gets executed at 1930:&lt;BR /&gt;&lt;BR /&gt;$ PIPE RMU/SH USERS TRAFFIC_STATS_RDB_DB | SEA SYS$INPUT "WISHART","CLARKR","AND&lt;BR /&gt;ERSONJ","STRICKLAND" /OUT=SYS$LOGIN:DVAX_SUTS.LIS&lt;BR /&gt;$ OPEN INPUT_FILE SYS$LOGIN:DVAX_SUTS.LIS&lt;BR /&gt;$ OPEN/WRITE  OUTPUT_FILE SYS$LOGIN:TEMP.COM&lt;BR /&gt;$ READ_LOOP:&lt;BR /&gt;$ READ/END_OF_FILE=ENDIT  INPUT_FILE  REC1&lt;BR /&gt;$ WRITE OUTPUT_FILE "$ STOP/ID= "+F$EXTRACT(6,8,REC1)&lt;BR /&gt;$ GOTO READ_LOOP&lt;BR /&gt;$ ENDIT:&lt;BR /&gt;$ CLOSE INPUT_FILE&lt;BR /&gt;$ CLOSE OUTPUT_FILE&lt;BR /&gt;$ msg "Following processes have been stopped:"&lt;BR /&gt;$ type sys$login:temp.com&lt;BR /&gt;$ !@SYS$LOGIN:TEMP.COM&lt;BR /&gt;$ EXIT&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Mike&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Jan 2009 00:54:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150392#M45106</guid>
      <dc:creator>smg_atlas</dc:creator>
      <dc:date>2009-01-14T00:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150393#M45107</link>
      <description>&amp;gt; [...] /log=dsa0:[backup.lockcheck]dblockclean.log&lt;BR /&gt;&lt;BR /&gt;Any clues in there?</description>
      <pubDate>Wed, 14 Jan 2009 01:16:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150393#M45107</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-01-14T01:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150394#M45108</link>
      <description>Context and error messages make this easier to debug.&lt;BR /&gt;&lt;BR /&gt;And in general, you've been provided with a DCL command procedure with some sort of unspecified problems and/or with a different intended use than the present sequence, and you're asking for debugging and coding support here?  Odd.  It would seem more expedient to get in contact with whomever gave you this DCL procedure, and ask them for help.&lt;BR /&gt;&lt;BR /&gt;As for other spots to look beyond the log file that Steve mentions (and do look there first!), also do look in the intermediate files used here:&lt;BR /&gt;&lt;BR /&gt; SYS$LOGIN:DVAX_SUTS.LIS&lt;BR /&gt; SYS$LOGIN:TEMP.COM&lt;BR /&gt;&lt;BR /&gt;The DCL procedure also appears to have code selected from and integrated from various spots; there are commented-out lines and some odd differences in coding styes.&lt;BR /&gt;&lt;BR /&gt;There are also potential issues with error handling (potential for collision with temporary files, lack of SET NOON or ON processing), with privileges (most database operations require privileges (and this DCL doesn't enable them).  &lt;BR /&gt;&lt;BR /&gt;There are some other areas of potential improvements, such as using CLOSE /NOLOG before the open.  Less of an issue with a batch job, having an open file can derail interactive invocations.&lt;BR /&gt;&lt;BR /&gt;Do some debug.  &lt;BR /&gt;&lt;BR /&gt;Or contact whomever gave you the tool.  &lt;BR /&gt;&lt;BR /&gt;Get some training on DCL and/or find a copy of the DCL book I wrote a while back and/or take a look at the OpenVMS User's Guide.&lt;BR /&gt;&lt;BR /&gt;Or a combination of these.&lt;BR /&gt;&lt;BR /&gt;But regardless, you're going to have to do some debugging here to get to the bottom of this.</description>
      <pubDate>Wed, 14 Jan 2009 01:48:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150394#M45108</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-01-14T01:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150395#M45109</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;  You create a file called TEMP.COM containing a sequence of STOP/ID commands to kill your processes, BUT the procedure never gets executed because the second last line is commented out. The procedure therefore says it has stopped the processes, but it hasn't.&lt;BR /&gt;&lt;BR /&gt; Why create a temporary file at all? It's just clutter. The file itself is clearly "one shot" because it's specific to a single point in time state, which it then destroys. Leaving it around is slightly dangerous as it kills what are effectively random PIDs (though the mechanism for allocating PIDs avoids short term reuse of PIDs, so will protect you from most accidents). &lt;BR /&gt;&lt;BR /&gt;Even if that were fixed, the SUBMIT command you've posted seems to be assuming the /NAME qualifier names the procedure to execute. It doesn't, it's just the job name. Your SUBMIT command therefore just submits and executes itself, but gives itself the name of another procedure. A recipe for confusion!&lt;BR /&gt;&lt;BR /&gt;Here's how I'd code it, with the SUBMIT logic included in the procedure itself. &lt;BR /&gt;&lt;BR /&gt;DVAXKILLSUTS.COM&lt;BR /&gt;&lt;BR /&gt;$ self=F$PARSE(";",F$ENVIRONMENT("PROCEDURE"))&lt;BR /&gt;$ IF p1.NES."" THEN GOTO 'p1'&lt;BR /&gt;$   IF F$MODE().EQS."BATCH" THEN @'self' SUBMIT&lt;BR /&gt;$   PIPE RMU/SHOW USERS TRAFFIC_STATS_RDB_DB | -&lt;BR /&gt;    SEARCH/NOHEAD SYS$PIPE "WISHART","CLARKR","ANDERSONJ","STRICKLAND" |-&lt;BR /&gt;    @'self' KILL&lt;BR /&gt;$ EXIT&lt;BR /&gt;$ SUBMIT:&lt;BR /&gt;$   SUBMIT 'self' -&lt;BR /&gt;      /AFTER="TOMORROW+19:30"/NOPRINT/KEEP -&lt;BR /&gt;      /LOG='F$PARSE("DSA0:[BACKUP.LOCKCHECK].LOG",self)'&lt;BR /&gt;$ EXIT&lt;BR /&gt;$ KILL: READ/END_OF_FILE=ENDIT SYS$PIPE REC1&lt;BR /&gt;$       pid=F$EDIT(F$ELEMENT(0,":",REC1),"COLLAPSE")-"-"&lt;BR /&gt;$       IF F$INTEGER("%x"+pid).NE.0&lt;BR /&gt;$       THEN&lt;BR /&gt;$         WRITE SYS$OUTPUT "Stopping ''REC1'"&lt;BR /&gt;$         STOP/IMAGE/ID='pid'&lt;BR /&gt;$       ENDIF&lt;BR /&gt;$   GOTO KILL&lt;BR /&gt;$ ENDIT:&lt;BR /&gt;$ EXIT&lt;BR /&gt;&lt;BR /&gt;Note I've put in a sanity check to check the value extracted from the listing looks reasonable. I'm also using STOP/IMAGE as it's a bit safer.&lt;BR /&gt;&lt;BR /&gt;To submit it:&lt;BR /&gt;&lt;BR /&gt;$ @DVAXKILLSUTS SUBMIT&lt;BR /&gt;&lt;BR /&gt;it will then resubmit itself daily.</description>
      <pubDate>Wed, 14 Jan 2009 03:25:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150395#M45109</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2009-01-14T03:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150396#M45110</link>
      <description>Mike,&lt;BR /&gt;     I have a couple of comments about the initial submission script you posted.   There does seem to be a couple of problems with it.&lt;BR /&gt;&lt;BR /&gt;type DBLOCKCLEAN.COM&lt;BR /&gt;$ dblockclean = f$environment("PROCEDURE")&lt;BR /&gt;$ SUBMIT 'dblockclean' -&lt;BR /&gt;/AFTER="TOMORROW+19:30"/NOPRINT/KEEP -&lt;BR /&gt;/NAME=dsa0 [backup.lockcheck]dvaxkillsuts.com -&lt;BR /&gt;/log=dsa0:[backup.lockcheck]dblockclean.log&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1.   The Qualifier "/NAME" is deceiving you.   It is NOT the name of the script that was submitted, it is just the name that is listed in the batch queue, under "JOB NAME"&lt;BR /&gt;2.   I also assume that you didn't cut-n-paste the text, since there is a colon missing after DSA0 in the /NAME line.&lt;BR /&gt;&lt;BR /&gt;The code above simply resubmits itself, nothing else.  The log file should verify that.&lt;BR /&gt;&lt;BR /&gt;Try&lt;BR /&gt;&lt;BR /&gt;$ SUBMIT DSA0:[backup.logcheck]dvaxkillsuts.com -&lt;BR /&gt;/AFTER="TOMORROW+19:30"/NOPRINT/KEEP -&lt;BR /&gt;/NAME="dvaxkillsuts" -&lt;BR /&gt;/log=dsa0:[backup.lockcheck]dvaxkillsuts.log&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Wed, 14 Jan 2009 13:21:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150396#M45110</guid>
      <dc:creator>The Brit</dc:creator>
      <dc:date>2009-01-14T13:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150397#M45111</link>
      <description>It's also possible to use RMU to close a database and/or to toss users off a database, too.  Nuking connected processes tends to mean Rdb has to clean up after the nuked users; that does and should work, but it's not necessarily the most efficient strategy.</description>
      <pubDate>Wed, 14 Jan 2009 17:15:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150397#M45111</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-01-14T17:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150398#M45112</link>
      <description>Thanks so much for your help!&lt;BR /&gt;&lt;BR /&gt;Steven:  I checked the log file dsa0:[backup.lockcheck]dblockclean.log and all it shows is the execution of the batch job - it executed successfully.&lt;BR /&gt;&lt;BR /&gt;John and The Brit:  Thanks for pointing out about the /name qualifier deceiving me! I'll try the suggestions you mention.&lt;BR /&gt;&lt;BR /&gt;I see what you mean about the 2nd last line being commented out, but correct me if I'm wrong in thinking that the file in question is just a record of the process id's stopped?&lt;BR /&gt;Ie: the actual topping of the processes is done by the reading in from the .lis and doing the stop/id on it? (if that makes sense).&lt;BR /&gt;&lt;BR /&gt;I'm not coming from a OpenVMS background at all and appreciate all your help to date.&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Jan 2009 22:43:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150398#M45112</guid>
      <dc:creator>smg_atlas</dc:creator>
      <dc:date>2009-01-14T22:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150399#M45113</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I see what you mean about the 2nd last line  being commented out, but&lt;BR /&gt;&amp;gt; correct me if I'm wrong in thinking that the file in question is just a&lt;BR /&gt;&amp;gt; record of the process id's stopped?&lt;BR /&gt;&lt;BR /&gt;No, you write the STOP commands to file TEMP.COM (and don't stop any process at this point). So you need to execute the file to get the STOP commands do their work. Just remove the "!" in fromt of that line.&lt;BR /&gt;&lt;BR /&gt;Hans.</description>
      <pubDate>Wed, 14 Jan 2009 23:53:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150399#M45113</guid>
      <dc:creator>H_Bachner</dc:creator>
      <dc:date>2009-01-14T23:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150400#M45114</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Ie: the actual topping of the processes is &lt;BR /&gt;&amp;gt;done by the reading in from the .lis and &lt;BR /&gt;&amp;gt;doing the stop/id on it? (if that makes &lt;BR /&gt;&amp;gt;sense).&lt;BR /&gt;&lt;BR /&gt;  No. As Hans said, you're writing the STOP command to a temporary file, rather than executing them.&lt;BR /&gt;&lt;BR /&gt;  It doesn't make much sense to me to write the file. What's the point? It just adds complexity, and leaves potentially dangerous junk on your disk. If accidently executed at some future time it may kill random processes.&lt;BR /&gt;&lt;BR /&gt;  You could simplify your procedure by removing the temporary file (see the procedure I posted earlier).&lt;BR /&gt;&lt;BR /&gt;  On the other hand, it sounds like an even better idea is Hoff's suggestion to use RMU to close the data base. Replace the whole procedure with a single command:&lt;BR /&gt;&lt;BR /&gt;$ RMU/CLOSE/CLUSTER/WAIT/ABORT=FORCEX TRAFFIC_STATS_RDB_DB &lt;BR /&gt;&lt;BR /&gt;(please check the Rdb documentation to make sure this does what you want, in particular, you may want /ABORT=DELPRC, depending on how you want incomplete transactions and recovery journals dealt with).&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jan 2009 02:44:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150400#M45114</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2009-01-15T02:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150401#M45115</link>
      <description>Thanks for the help, problem has been resolved by following some of the suggestions / ideas presented.  Points awarded.</description>
      <pubDate>Fri, 23 Jan 2009 05:04:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150401#M45115</guid>
      <dc:creator>smg_atlas</dc:creator>
      <dc:date>2009-01-23T05:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script error when executing in batch queue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150402#M45116</link>
      <description>See above.</description>
      <pubDate>Fri, 23 Jan 2009 05:05:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/script-error-when-executing-in-batch-queue/m-p/5150402#M45116</guid>
      <dc:creator>smg_atlas</dc:creator>
      <dc:date>2009-01-23T05:05:19Z</dc:date>
    </item>
  </channel>
</rss>

