<?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: DCL command 'SUBMIT' exit status check in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252056#M40372</link>
    <description>Joost,&lt;BR /&gt;  Taking another (more general) approach...&lt;BR /&gt;&lt;BR /&gt;Since the error message is in the log file, which is periodically flushed, you can get the message live from the log file at run time with, for example, TYPE/TAIL, or any other command which can read a shared file. You can therefore use ON WARNING to collect error messages from ANY command which generates an error using a GOSUB so you don't interrupt the flow of execution. Try this:&lt;BR /&gt;&lt;BR /&gt;CATCHWARN.COM&lt;BR /&gt;$ SET NOON&lt;BR /&gt;$ SET VERIFY&lt;BR /&gt;$ GOSUB SetupLog&lt;BR /&gt;$&lt;BR /&gt;$ WRITE SYS$OUTPUT "Some stuff in the log file"&lt;BR /&gt;$ SHOW PROCESS&lt;BR /&gt;$&lt;BR /&gt;$ WRITE SYS$OUTPUT "Now generate some errors"&lt;BR /&gt;$&lt;BR /&gt;$ TYPE junk.dat&lt;BR /&gt;$&lt;BR /&gt;$ SUBMIT/QUEUE=noqueue nojob&lt;BR /&gt;$&lt;BR /&gt;$ WRITE SYS$OUTPUT "More stuff in log file"&lt;BR /&gt;$ EXIT&lt;BR /&gt;$&lt;BR /&gt;$ SetupLog: v='F$VERIFY(0)'&lt;BR /&gt;$   outrate="0:0:01"&lt;BR /&gt;$   SET OUTPUT_RATE='outrate'&lt;BR /&gt;$   mylog=F$PARSE(F$GETQUI("DISPLAY_ENTRY","LOG_SPECIFICATION",,"THIS_JOB"),-&lt;BR /&gt;             "SYS$LOGIN:.LOG;",F$GETQUI("DISPLAY_ENTRY","JOB_NAME",,"THIS_JOB"))&lt;BR /&gt;$   SHOW SYM mylog&lt;BR /&gt;$   OPEN/WRITE log SYS$LOGIN:OTHER.LOG&lt;BR /&gt;$   ON WARNING THEN GOSUB Logit&lt;BR /&gt;$ RETURN ! 'F$VERIFY(v)'&lt;BR /&gt;$&lt;BR /&gt;$ Logit: stat=$STATUS ! 'F$VERIFY(0)'&lt;BR /&gt;$   WAIT 'outrate'&lt;BR /&gt;$   WRITE log "Error status=''stat' at ''F$TIME()' Last 5 lines in ''mylog'"&lt;BR /&gt;$   WRITE log "-----"&lt;BR /&gt;$   PIPE TYPE/TAIL=5/HEADER 'mylog' &amp;gt; log&lt;BR /&gt;$   WRITE log "-----"&lt;BR /&gt;$   ON WARNING THEN GOSUB Logit&lt;BR /&gt;$ RETURN 1+0*F$VERIFY(v)&lt;BR /&gt;&lt;BR /&gt;So, subroutine SetupLog finds the log file of the batch job, and creates a secondary log file. It also saves verification state and sets the output rate to a known value.&lt;BR /&gt;We then use:&lt;BR /&gt;&lt;BR /&gt;$ ON WARNING THEN GOSUB Logit&lt;BR /&gt;&lt;BR /&gt;to execute a subroutine any time a WARNING or higher condition occurs.&lt;BR /&gt;&lt;BR /&gt;Subroutine Logit waits for the output rate period, to make sure any messages up to the warning event have been flushed to the log. It then writes a report line and dumps the last 5 lines of the file into the secondary log file. Finally it resets the ON WARNING condition and restores verification.&lt;BR /&gt;&lt;BR /&gt;Note that the RETURN must return a success status, otherwise it will immediately call Logit again after returning (infinite loop). That means the only change from "normal" DCL in your mainline, is any additional processing of status needs to look at "stat" instead of $STATUS, (but you need to make sure an "old" value in "stat" isn't picked up later as it isn't automatically updated, like $STATUS).&lt;BR /&gt;&lt;BR /&gt;Another option in communicating status back to the main line would be to use the unused success status 7 to indicate an error. So, the end of Logit could look like:&lt;BR /&gt;&lt;BR /&gt;$ RETURN stat.OR.7+0*F$VERIFY(v)&lt;BR /&gt;&lt;BR /&gt;Your mainline then knows an error or warning has occured if $SEVERITY is 7, and can retrieve the actual status (including the true severity) from "stat".&lt;BR /&gt;&lt;BR /&gt;$ SUBMIT/QUEUE=noqueue nojob&lt;BR /&gt;$ IF $SEVERITY.EQ.7&lt;BR /&gt;$ THEN&lt;BR /&gt;$   WRITE SYS$OUTPUT "Submit failed - status ''stat'"&lt;BR /&gt;$ ENDIF&lt;BR /&gt;&lt;BR /&gt;Have fun!</description>
    <pubDate>Wed, 18 Aug 2010 21:30:32 GMT</pubDate>
    <dc:creator>John Gillings</dc:creator>
    <dc:date>2010-08-18T21:30:32Z</dc:date>
    <item>
      <title>DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252038#M40354</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;This concerns a DCL script that resubmits itself.&lt;BR /&gt;I would like to verify the exit status of the submit command executed by the script.&lt;BR /&gt;&lt;BR /&gt;Relevant code:&lt;BR /&gt;$ PIPE 'SUBMITCMD' | (read sys$pipe p9 ; DEF/JOB P9 &amp;amp;P9)&lt;BR /&gt;$ RESULT = f$trnlnm("P9")&lt;BR /&gt;$ IF F$LOCATE ("Job CDRC",RESULT) .NES. F$LENGTH(RESULT)&lt;BR /&gt;$ THEN&lt;BR /&gt;$   CALL LOGTHIS "''RESULT'" "IN"&lt;BR /&gt;$ ELSE&lt;BR /&gt;$   CALL LOGTHIS "''RESULT'" "ER"&lt;BR /&gt;$ ENDIF&lt;BR /&gt;&lt;BR /&gt;Where IN and ER reflect the severity (IN = informational, ER = error). I'm wondering if the test conditions are sufficient. This should depend on whether or not the return messages of SUBMIT can also start with 'Job CDRC' for any kind of failure. I don't think it does, as I expect failures to be logged in system messages formatting (%facility-s-identification, text).&lt;BR /&gt;&lt;BR /&gt;Is there a list of possible exit messages for SUBMIT?</description>
      <pubDate>Wed, 18 Aug 2010 08:58:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252038#M40354</guid>
      <dc:creator>Joost van der Knaap</dc:creator>
      <dc:date>2010-08-18T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252039#M40355</link>
      <description>Joost&lt;BR /&gt;&lt;BR /&gt;Can you not just check $STATUS of the SUBMIT?&lt;BR /&gt;&lt;BR /&gt;$ SUBMIT &amp;lt;script&amp;gt;&lt;BR /&gt;$ STATUS := '$STATUS'&lt;BR /&gt;$ IF STATUS&lt;BR /&gt;$  THEN&lt;BR /&gt;$   ! Success processing&lt;BR /&gt;$  ELSE&lt;BR /&gt;$   ! Failure processing&lt;BR /&gt;$ ENDIF&lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Wed, 18 Aug 2010 09:09:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252039#M40355</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2010-08-18T09:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252040#M40356</link>
      <description>Hi Craig,&lt;BR /&gt;&lt;BR /&gt;I could, but I would like to log the exact message.</description>
      <pubDate>Wed, 18 Aug 2010 09:17:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252040#M40356</guid>
      <dc:creator>Joost van der Knaap</dc:creator>
      <dc:date>2010-08-18T09:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252041#M40357</link>
      <description>Joost&lt;BR /&gt;&lt;BR /&gt;Can you please explain what you are ultimately trying to achieve?&lt;BR /&gt;&lt;BR /&gt;You could redirect sys$output to a temporary logfile and then interrogate that:&lt;BR /&gt;&lt;BR /&gt;$ DEFINE/USER SYS$OUTPUT SUBMIT.LIS&lt;BR /&gt;$ DEFINE/USER SYS$ERROR SUBMIT.LIS&lt;BR /&gt;$ SUBMIT &amp;lt;script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Wed, 18 Aug 2010 09:27:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252041#M40357</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2010-08-18T09:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252042#M40358</link>
      <description>Goal 1: Differentiate between success and failure of SUBMIT.&lt;BR /&gt;Status: Fully met?&lt;BR /&gt;&lt;BR /&gt;Goal 2: Be able to see in the log why a SUBMIT command failed.&lt;BR /&gt;Status: Fully met through subroutine LOGTHIS&lt;BR /&gt;&lt;BR /&gt;Goal 3 (ultimate): solution combining goal 1 and goal 2.&lt;BR /&gt;Status: Fully met?&lt;BR /&gt;&lt;BR /&gt;As you said, goal 1 can be achieved through $STATUS, but then I would not capture the error reason to feed it to the LOGTHIS subroutine.&lt;BR /&gt;&lt;BR /&gt;The main reason why I started this thread was to learn whether or not I have already met goal 1 by checking the return string for the text 'Job CDRC'. The docs on system error messages and on the SUBMIT command I've found haven't convinced me that there couldn't be an error condition that would result in a string that passes the F$LOCATE check.&lt;BR /&gt;&lt;BR /&gt;I kind of like the method of storing the returned string as a logical instead of a temporary logfile.</description>
      <pubDate>Wed, 18 Aug 2010 09:48:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252042#M40358</guid>
      <dc:creator>Joost van der Knaap</dc:creator>
      <dc:date>2010-08-18T09:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252043#M40359</link>
      <description>Joost&lt;BR /&gt;&lt;BR /&gt;Can you not just pass SUBMIT.LIS through to the subroutine LOGTHIS to do something useful with it? &lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Wed, 18 Aug 2010 10:00:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252043#M40359</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2010-08-18T10:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252044#M40360</link>
      <description>Why not combine status check and output logging ?&lt;BR /&gt;Instead &lt;BR /&gt;$ IF F$LOCATE ("Job CDRC",RESULT) .NES. F$LENGTH(RESULT)&lt;BR /&gt;use&lt;BR /&gt;$if  f$integer($SEVERITY).eq.1 &lt;BR /&gt;&lt;BR /&gt;and leave anything else as is, but do not derive success/error from a particular output string.</description>
      <pubDate>Wed, 18 Aug 2010 10:21:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252044#M40360</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-08-18T10:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252045#M40361</link>
      <description>In addition:&lt;BR /&gt;if You really want to log the full submit error message in a separate log-file, then a single read is not enough: those usually are two lines, example:&lt;BR /&gt;&lt;BR /&gt;MPIW10_HUB&amp;gt;pipe submit xyz | (read sys$pipe p9 ; DEF/JOB P9 &amp;amp;P9)&lt;BR /&gt;MPIW10_HUB&amp;gt;sh log p9&lt;BR /&gt;   "P9" = "%SUBMIT-F-OPENIN, error opening DISK$HUBER:[HUBER.SOURCES.C]xyz.COM; as input" (LNM$JOB_81838080)&lt;BR /&gt;MPIW10_HUB&amp;gt;submit xyz&lt;BR /&gt;%SUBMIT-F-OPENIN, error opening DISK$HUBER:[HUBER.SOURCES.C]xyz.COM; as input&lt;BR /&gt;-RMS-E-FNF, file not found&lt;BR /&gt;&lt;BR /&gt;The single read from pipe only gets the %SUBMIT-F line, the important second line giving the reason (-RMS-E-FNF...) is not logged!&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2010 10:28:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252045#M40361</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-08-18T10:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252046#M40362</link>
      <description>Also, if it wer me, I'd be performing validation of certain things before doing the actual SUBMIT:&lt;BR /&gt;&lt;BR /&gt;Username (if /USER I BEING USEd)&lt;BR /&gt;Filename - F$SEARCH &lt;BR /&gt;Queue - Exist? in started state? &lt;BR /&gt;&lt;BR /&gt;Craig&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2010 10:36:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252046#M40362</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2010-08-18T10:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252047#M40363</link>
      <description>@Joseph:&lt;BR /&gt;Thanks for suggesting f$integer($SEVERITY). I didn't even try that as I thought it would no longer relate to SUBMIT due to the stuff that happens between it and the IF statement.&lt;BR /&gt;&lt;BR /&gt;@Craig:&lt;BR /&gt;Valid points. In my case resubmitting is pretty much the first thing it does so I can be reasonably sure the file still exists as does the user.</description>
      <pubDate>Wed, 18 Aug 2010 10:47:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252047#M40363</guid>
      <dc:creator>Joost van der Knaap</dc:creator>
      <dc:date>2010-08-18T10:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252048#M40364</link>
      <description>&amp;gt;&amp;gt; I didn't even try that as I thought it would no longer relate to SUBMIT due to the stuff that happens between it and the IF statement.&lt;BR /&gt;&lt;BR /&gt;And You are right to think so: $STATUS/$SEVERITY is that after the pipe, not what You want.&lt;BR /&gt;&lt;BR /&gt;The only solution I can see is to write the SUBMIT command message into a temporary file, and chain the command with an command-file, which saves the $STATUS/$SEVERITY, then reads and logs the temporary file:&lt;BR /&gt;&lt;BR /&gt; $ PIPE SUBMIT ... &amp;gt;tempfile ; @logit tempfile&lt;BR /&gt;&lt;BR /&gt;"PIPE ; " does not create a subprocess (no sys$pipe), but has valid $STATUS in @logit.&lt;BR /&gt;"PIPE | " creates a subprocess with sys$pipe, but then $STATUS is not available.&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2010 11:26:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252048#M40364</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-08-18T11:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252049#M40365</link>
      <description>In that case I think I might follow some of Craig's suggestions and do something like this:&lt;BR /&gt;&lt;BR /&gt;$ DEFINE/JOB SYS$OUTPUT SUBMIT.LIS&lt;BR /&gt;$ DEFINE/JOB SYS$ERROR SUBMIT.LIS&lt;BR /&gt;$ 'SUBMITCMD'&lt;BR /&gt;$ STATUS := "''$status' ''$severity'"&lt;BR /&gt;$ SHOW SYMBOL STATUS&lt;BR /&gt;$ DEASSIGN/JOB SYS$OUTPUT&lt;BR /&gt;$ DEASSIGN/JOB SYS$ERROR&lt;BR /&gt;&lt;BR /&gt;And then open the file to determine the results.&lt;BR /&gt;&lt;BR /&gt;Either way it seems I'm not going to avoid additional I/O and a cleanup subroutine for temp files.</description>
      <pubDate>Wed, 18 Aug 2010 12:17:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252049#M40365</guid>
      <dc:creator>Joost van der Knaap</dc:creator>
      <dc:date>2010-08-18T12:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252050#M40366</link>
      <description>Joost&lt;BR /&gt;&lt;BR /&gt;If you use /USER rather then /JOB then the definition only remains in place for the next image activAtion. In this case the use of SUBMIT.EXE&lt;BR /&gt;&lt;BR /&gt;So you don't need to DEASSIGN the logicals.&lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Wed, 18 Aug 2010 12:55:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252050#M40366</guid>
      <dc:creator>Craig A</dc:creator>
      <dc:date>2010-08-18T12:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252051#M40367</link>
      <description>...And we're writing a home-grown scheduler (job controller, or cron or process manager or whatever you want to call it) to make up for this particular feature deficit within VMS...&lt;BR /&gt;&lt;BR /&gt;OP: look around for a scheduler.  cron or kronos are bad, but low-budget options.  Commercial options are better.&lt;BR /&gt;&lt;BR /&gt;Previous scheduler discussions...&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1433428" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1433428&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1433119" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1433119&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1394447" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1394447&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1439970" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1439970&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1301490" target="_blank"&gt;https://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1301490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1309755" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1309755&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1433407" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1433407&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1393184" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1393184&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Maybe some future VMS release will have a scheduler...</description>
      <pubDate>Wed, 18 Aug 2010 13:19:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252051#M40367</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2010-08-18T13:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252052#M40368</link>
      <description>There are a couple of cases where SUBMIT outputs an informational message before the line that has "JOB jobname".&lt;BR /&gt;&lt;BR /&gt;$ SUBMIT  LOGIN /NOLOG /RETAIN=UNTIL=YESTERDAY&lt;BR /&gt;%JBC-I-ITMREMOVED, meaningless items were removed from request&lt;BR /&gt;Job LOGIN (queue SYS$BATCH_AX38, entry 2003955) started on SYS$BATCH_AX38&lt;BR /&gt;&lt;BR /&gt;These would cause your test of the first output line for the string "JOB jobname" to fail.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2010 17:04:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252052#M40368</guid>
      <dc:creator>Jess Goodman</dc:creator>
      <dc:date>2010-08-18T17:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252053#M40369</link>
      <description>Just to add another solution avoiding a temporary file:&lt;BR /&gt;&lt;BR /&gt; pipe (submit xyz ; write sys$output "SEV: ",$severity) | @logit&lt;BR /&gt;&lt;BR /&gt;This puts the severity of the SUBMIT as last line to the output pipe.&lt;BR /&gt;So logit.com can do a read loop on sys$pipe, and check for a line starting with "SEV:" to handle the results.</description>
      <pubDate>Wed, 18 Aug 2010 19:02:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252053#M40369</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-08-18T19:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252054#M40370</link>
      <description>The DCL code for the above solution could look like this:&lt;BR /&gt;&lt;BR /&gt;$ me=f$environment("PROCEDURE")&lt;BR /&gt;$ if p1.eqs."#LOG#" then goto LOG&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;$ pipe (submit xyz ; write sys$output "SEV: ",$severity) | @'me' #LOG#&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;$LOG:&lt;BR /&gt;$ n=0&lt;BR /&gt;$LOOP:&lt;BR /&gt;$ read/end=DONE sys$pipe line&lt;BR /&gt;$ if f$extract(0,4,line).eqs."SEV:"&lt;BR /&gt;$ then &lt;BR /&gt;$ severity = f$element(1," ",line)&lt;BR /&gt;$ else&lt;BR /&gt;$ line'n' = line&lt;BR /&gt;$ n=n+1&lt;BR /&gt;$ endif&lt;BR /&gt;$ goto LOOP&lt;BR /&gt;$DONE:&lt;BR /&gt;$ tag="ER"&lt;BR /&gt;$ if f$integer(severity).eq.1 then tag="IN"&lt;BR /&gt;$ i=0&lt;BR /&gt;$LL:&lt;BR /&gt;$ result = line'i'&lt;BR /&gt;$ CALL LOGTHIS "''RESULT'" 'tag'&lt;BR /&gt;$ i=i+1&lt;BR /&gt;$ if i.lt.n then goto LL&lt;BR /&gt;$ exit&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2010 19:52:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252054#M40370</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-08-18T19:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252055#M40371</link>
      <description>Joost,&lt;BR /&gt;&lt;BR /&gt;First to answer your direct question:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Is there a list of possible exit &lt;BR /&gt;&amp;gt;messages for SUBMIT?&lt;BR /&gt;&lt;BR /&gt;  In theory, you might be able to work it out, but in practice, not really. Looking at the source of SUBMIT you may be able to find all the condition codes which are explicitly signalled or returned, but you then need to consider all the subsystems it calls - SYS$, RMS$, LCK$ and on and on. This becomes a very large, and somewhat unpredictable set. Even if you could construct such a set, it could potentially change in future, so you make yourself a maintenance task.&lt;BR /&gt; &lt;BR /&gt;Onwards...&lt;BR /&gt;&lt;BR /&gt;  I think you're making this far more complex than necessary. As I see it there are two issues: &lt;BR /&gt;&lt;BR /&gt;1) You want the procedure to detect if the SUBMIT was successful (or, more generally, any particular action in your procedure)&lt;BR /&gt;&lt;BR /&gt;2) If an action fails you want to capture the exact and complete error message.&lt;BR /&gt;&lt;BR /&gt;Your problem is you're trying to do both simultaneously, which is leading to convoluted code to try and account for many possibilities (for example, multiple lines of error message). This also adds extra things that might fail, and thus you recurse into a cascade of checks upon checks upon checks.&lt;BR /&gt;&lt;BR /&gt;Try tackling each issue separately. 1 is simple, use $STATUS&lt;BR /&gt;&lt;BR /&gt;$ SUBMIT ...whatever&lt;BR /&gt;$ stat=$STATUS&lt;BR /&gt;$ IF stat&lt;BR /&gt;$ THEN&lt;BR /&gt;$   ...OK&lt;BR /&gt;$ ELSE&lt;BR /&gt;$   ...Failed&lt;BR /&gt;$ ENDIF&lt;BR /&gt;&lt;BR /&gt;Simple!&lt;BR /&gt;&lt;BR /&gt;For 2, realise that the error message is complete and intact in the log file of the batch job. You can log that an error occurred, including the primary status. You can also add a pointer to the log file containing the completetext:&lt;BR /&gt;&lt;BR /&gt;$       IF F$GETQUI("DISPLAY_ENTRY","JOB_LOG_NULL",,"THIS_JOB")&lt;BR /&gt;$       THEN&lt;BR /&gt;$         Msg = "(no log file)"&lt;BR /&gt;$       ELSE&lt;BR /&gt;$         Msg = "See Logfile:"+F$PARSE(F$GETQUI("DISPLAY_ENTRY","LOG_SPECIFICATION",,"THIS_JOB"),-&lt;BR /&gt;                            "SYS$LOGIN:.LOG;",F$GETQUI("DISPLAY_ENTRY","JOB_NAME",,"THIS_JOB"))&lt;BR /&gt;$       ENDIF&lt;BR /&gt;$       out=F$FAO("!AS: !UL error!%S in !AS on node !AS. !AS",Name,Err,Title,Node,Msg)&lt;BR /&gt;&lt;BR /&gt;(in this example, I count the number of errors that occurred in symbol "Err" - the message is then MAILed at the end of the job.&lt;BR /&gt;&lt;BR /&gt;To further highlight any issues, I usually submit jobs with /RETAIN=ERROR, and track the worst status value in symbol "stat". Last line is:  &lt;BR /&gt;&lt;BR /&gt; $ EXIT %X10000000.OR.F$INTEGER(stat)+(F$VERIFY(verf).AND.0)&lt;BR /&gt;&lt;BR /&gt;"verf" contains the verification value on entry, stat is the completion code, and %X10000000 sets the STS$M_INHIB bit to tell DCL not to display an error message.&lt;BR /&gt;&lt;BR /&gt;I have a daily job that hunts for and reports on any retained jobs.  &lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2010 20:52:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252055#M40371</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2010-08-18T20:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252056#M40372</link>
      <description>Joost,&lt;BR /&gt;  Taking another (more general) approach...&lt;BR /&gt;&lt;BR /&gt;Since the error message is in the log file, which is periodically flushed, you can get the message live from the log file at run time with, for example, TYPE/TAIL, or any other command which can read a shared file. You can therefore use ON WARNING to collect error messages from ANY command which generates an error using a GOSUB so you don't interrupt the flow of execution. Try this:&lt;BR /&gt;&lt;BR /&gt;CATCHWARN.COM&lt;BR /&gt;$ SET NOON&lt;BR /&gt;$ SET VERIFY&lt;BR /&gt;$ GOSUB SetupLog&lt;BR /&gt;$&lt;BR /&gt;$ WRITE SYS$OUTPUT "Some stuff in the log file"&lt;BR /&gt;$ SHOW PROCESS&lt;BR /&gt;$&lt;BR /&gt;$ WRITE SYS$OUTPUT "Now generate some errors"&lt;BR /&gt;$&lt;BR /&gt;$ TYPE junk.dat&lt;BR /&gt;$&lt;BR /&gt;$ SUBMIT/QUEUE=noqueue nojob&lt;BR /&gt;$&lt;BR /&gt;$ WRITE SYS$OUTPUT "More stuff in log file"&lt;BR /&gt;$ EXIT&lt;BR /&gt;$&lt;BR /&gt;$ SetupLog: v='F$VERIFY(0)'&lt;BR /&gt;$   outrate="0:0:01"&lt;BR /&gt;$   SET OUTPUT_RATE='outrate'&lt;BR /&gt;$   mylog=F$PARSE(F$GETQUI("DISPLAY_ENTRY","LOG_SPECIFICATION",,"THIS_JOB"),-&lt;BR /&gt;             "SYS$LOGIN:.LOG;",F$GETQUI("DISPLAY_ENTRY","JOB_NAME",,"THIS_JOB"))&lt;BR /&gt;$   SHOW SYM mylog&lt;BR /&gt;$   OPEN/WRITE log SYS$LOGIN:OTHER.LOG&lt;BR /&gt;$   ON WARNING THEN GOSUB Logit&lt;BR /&gt;$ RETURN ! 'F$VERIFY(v)'&lt;BR /&gt;$&lt;BR /&gt;$ Logit: stat=$STATUS ! 'F$VERIFY(0)'&lt;BR /&gt;$   WAIT 'outrate'&lt;BR /&gt;$   WRITE log "Error status=''stat' at ''F$TIME()' Last 5 lines in ''mylog'"&lt;BR /&gt;$   WRITE log "-----"&lt;BR /&gt;$   PIPE TYPE/TAIL=5/HEADER 'mylog' &amp;gt; log&lt;BR /&gt;$   WRITE log "-----"&lt;BR /&gt;$   ON WARNING THEN GOSUB Logit&lt;BR /&gt;$ RETURN 1+0*F$VERIFY(v)&lt;BR /&gt;&lt;BR /&gt;So, subroutine SetupLog finds the log file of the batch job, and creates a secondary log file. It also saves verification state and sets the output rate to a known value.&lt;BR /&gt;We then use:&lt;BR /&gt;&lt;BR /&gt;$ ON WARNING THEN GOSUB Logit&lt;BR /&gt;&lt;BR /&gt;to execute a subroutine any time a WARNING or higher condition occurs.&lt;BR /&gt;&lt;BR /&gt;Subroutine Logit waits for the output rate period, to make sure any messages up to the warning event have been flushed to the log. It then writes a report line and dumps the last 5 lines of the file into the secondary log file. Finally it resets the ON WARNING condition and restores verification.&lt;BR /&gt;&lt;BR /&gt;Note that the RETURN must return a success status, otherwise it will immediately call Logit again after returning (infinite loop). That means the only change from "normal" DCL in your mainline, is any additional processing of status needs to look at "stat" instead of $STATUS, (but you need to make sure an "old" value in "stat" isn't picked up later as it isn't automatically updated, like $STATUS).&lt;BR /&gt;&lt;BR /&gt;Another option in communicating status back to the main line would be to use the unused success status 7 to indicate an error. So, the end of Logit could look like:&lt;BR /&gt;&lt;BR /&gt;$ RETURN stat.OR.7+0*F$VERIFY(v)&lt;BR /&gt;&lt;BR /&gt;Your mainline then knows an error or warning has occured if $SEVERITY is 7, and can retrieve the actual status (including the true severity) from "stat".&lt;BR /&gt;&lt;BR /&gt;$ SUBMIT/QUEUE=noqueue nojob&lt;BR /&gt;$ IF $SEVERITY.EQ.7&lt;BR /&gt;$ THEN&lt;BR /&gt;$   WRITE SYS$OUTPUT "Submit failed - status ''stat'"&lt;BR /&gt;$ ENDIF&lt;BR /&gt;&lt;BR /&gt;Have fun!</description>
      <pubDate>Wed, 18 Aug 2010 21:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252056#M40372</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2010-08-18T21:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: DCL command 'SUBMIT' exit status check</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252057#M40373</link>
      <description>@everyone: Thanks for all the suggestions.&lt;BR /&gt;As usual in DCL, there seem to be plenty ways of going about it.&lt;BR /&gt;&lt;BR /&gt;Per John Gillings' last remark - I'm off to have fun with this.</description>
      <pubDate>Thu, 19 Aug 2010 05:56:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-command-submit-exit-status-check/m-p/5252057#M40373</guid>
      <dc:creator>Joost van der Knaap</dc:creator>
      <dc:date>2010-08-19T05:56:28Z</dc:date>
    </item>
  </channel>
</rss>

