Operating System - OpenVMS
1748169 Members
3977 Online
108758 Solutions
New Discussion юеВ

Re: Script problem for automatic execution

 
Gajendra
New Member

Script problem for automatic execution

Hello friends..
i am new to openVMS and i want to build a copy.com file to execute every half hour. I have tried as below

$ THIS=F$ENVIRONMENT("PROCEDURE")
$ THIS=THIS-F$PARSE(THIS,,,"VERSION")
$ QNAME=F$GETQUI("DISPLAY_QUEUE","QUEUE_NAME","*","THIS_JOB")
$ SHOW SYM QNAME
$ SUBMIT 'THIS'/QUE='QNAME'/AFTER=("F$TIME()'+00:30")
$ NEXT_NOW=F$CVTIME("","ABSOLUTE")
$ SHOW SYMBOL NEXT_NOW
! copy.com commands
!


Output:

QNAME = ""
%DCL-W-VALREQ, missing qualifier or keyword value - supply all required values
NEXT_NOW = "29-JAN-2009 10:10:57.78"

Here the mode is interactive (i.e. by F$MODE)
i know that i have to run this script in batch mode but how to run it in batch mode that i dont know or some thing i am forgot to execute..Please guide me
Here queue is also not created when submitting directly in prompt directly By submit command.

5 REPLIES 5
Hein van den Heuvel
Honored Contributor

Re: Script problem for automatic execution

Compliments on a good start for a newbie!
(Good google skills and/or excellent learning skills :-)

If you run this script online, as @script_name, then there is no job, and thus no quename. So instead of running it with @, just submit it manually a first time, on te target queue: $SUBM/QUE=some_queue_name script_name

Alternatively, do some defensive coding.
After the QNAME=F$GETQUI... the srcipt SHOULD test for a return value. If empty it can choose to bail out, or provide an alternative. So either

$IF qname .EQS. "" THEN qname = "some_queue_name"

Or...

$IF qname .EQS. "" THEN GOTO no_queue
:
:
$no_queue:
$WRITE SYS$OUTPUT "Could not get QUEUE NAME, Please submit on desired queue"
$EXIT 16

Enjoy,
Hein


Steven Schweda
Honored Contributor

Re: Script problem for automatic execution

> [...] how to run it in batch mode that i
> dont know [...]

"HELP SUBMIT"? Do what's in the procedure,
but without the "/AFTER=xxx"?

> $ THIS=THIS-F$PARSE(THIS,,,"VERSION")

I might do:

this = f$parse( ";", this, , , "SYNTAX_ONLY")

> $ SUBMIT 'THIS'/QUE='QNAME'/AFTER=("F$TIME()'+00:30")
> $ NEXT_NOW=F$CVTIME("","ABSOLUTE")

Were you trying to do something like this?

NEXT_NOW = F$CVTIME( "''F$TIME()'+00:30", "ABSOLUTE")
SUBMIT 'THIS' /QUE = 'QNAME' AFTER = "''NEXT_NOW'"

Are you writing this procedure fresh, or are
you trying to modify an existing procedure?

A Forum search for keywords like
batch resubmit
should find many old examples.

> Here queue is also not created when
> submitting directly in prompt directly By
> submit command.

SUBMIT does not create a queue, it submits a
job to a queue.

We can't see your "submit command", so it's
hard to say much about it. Showing actual
commands with their actual output can be more
helpful than a vague description.
Hoff
Honored Contributor

Re: Script problem for automatic execution

The following doesn't target your specific question, but rather how to get to the answer of your specific question.

The DCL command SET VERIFY is your friend here when you're trying to figure out why some local DCL logic has gone weird.

Typical DCL debugging is comparatively primitive and "bread-crumb" style debugging, using WRITE SYS$OUTPUT and SET VERIFY (or f$verify()) to diagnose and debug.

As for the root goal, your approach will work, but I'd suggest looking at Kronos or other package; there's a Kronos update around, and there are other scheduling packages for OpenVMS such as cron. And there are various commercial packages. The downfall of your approach (and most of us use or have used your approach at one time or another; I have) is around error processing and error handling. When the jobs go weird or the queues go weird or the node crashes while active, or...

Links to Kronos and cron tools for OpenVMS and related are here:
http://64.223.189.234/node/97

And guessing at what you're using COPY for here, here's an approach that is ancient and effective, but little-known:
http://64.223.189.234/node/136

Joseph Huber_1
Honored Contributor

Re: Script problem for automatic execution

Gajendra, is it just coincidence, or are You the alter ego of GP1 on
http://www.computing.net/answers/openvms/how-to-run-script-at-30-min-automat/556.html
?
http://www.mpp.mpg.de/~huber
John Gillings
Honored Contributor

Re: Script problem for automatic execution

Gajendra,

(some more DCL coding opinions...)

$ THIS=F$ENVIRONMENT("PROCEDURE")
$ THIS=THIS-F$PARSE(THIS,,,"VERSION")

Here's a neater way to get the same result:

$ THIS=F$PARSE(";",F$ENVIRONMENT("PROCEDURE"))

This is arguably "more correct" as all the parsing and manipulation is being done by RMS. There may be pathological ODS-5 file specifications that may not work correctly with the string subtraction.

$ QNAME=F$GETQUI("DISPLAY_QUEUE","QUEUE_NAME","*","THIS_JOB")

Although it probably doesn't make much difference, I tend to leave out the "*". I worry about GETQUI wildcard context.

$ QNAME=F$GETQUI("DISPLAY_QUEUE","QUEUE_NAME",,"THIS_JOB")

The problem here is QNAME will be blank if this procedure is executed in any mode other than batch. You then need to decide which queue you want in that situation. If you want to specify a default queue, something like:

$ IF QNAME.EQS."" THEN QNAME="defaultname"
$ SUBMIT/QUEUE='QNAME' ...

or you could just take the process default

$ IF QNAME.NES."" THEN QNAME="/QUEUE="+QNAME
$ SUBMIT 'qname' ...

For the time, you can use:

/AFTER="''F$CVTIME("+0:30","ABSOLUTE")'"
A crucible of informative mistakes