Operating System - OpenVMS
1752288 Members
4392 Online
108786 Solutions
New Discussion юеВ

Re: How to control execution time of DCL commands

 
SOLVED
Go to solution
JVK_1
New Member

How to control execution time of DCL commands

Hi,

I am using Open VMS version 7.3-2.
I have a problem executing a command procedure with FTP commands in it. Sometimes the FTP command does not exit due to slow connections. In such a case a manual CTRL+Y needs to be done but instead i want to abort and continue with the remaining execution automatically. How can i run the command procedure for certain duration of time so that it terminates irrespective of whether the FTP commands have been executed or not?
16 REPLIES 16
Karl Rohwedder
Honored Contributor

Re: How to control execution time of DCL commands

You may spawn individual commands or procedures using /NOWAIT, wait a specific amount of time in the master process and then continue and/or kill the subprocess.

regards Kalle
JVK_1
New Member

Re: How to control execution time of DCL commands

hi Kalle,

Thanks a lot for your suggestion. I'll try it out.

Regards,
VIjay.
Robert Gezelter
Honored Contributor

Re: How to control execution time of DCL commands

Vijay,

Another alternative is to use the batch queues, although there is no guarantee that the job starts immediately (the queue may be busy or stopped).

In either case, be very careful that it is possible to tell the difference between a completed and uncompleted task. It is all too easy to find that ftp has transferred less than a complete file, and have later stages of the application become confused by processing a truncated file.

- Bob Gezelter, http://www.rlgsc.com
JVK_1
New Member

Re: How to control execution time of DCL commands

Hi Robert,

Thanks a lot for the reply. Will try to implement.
I have another question. Can the same command procedure be invoked simultaneously by different processes passing different parameters (like FTP address and file names) ? something like multithreading..In such a case where each request to that command procedure is processed seperately (and simultaneously) using NOWAIT will be easier..
JVK_1
New Member

Re: How to control execution time of DCL commands

sorry BOB for the wrong name used..mistake.. :)
Steven Schweda
Honored Contributor

Re: How to control execution time of DCL commands

> [...] Can the same command procedure be
> invoked simultaneously by different
> processes [...]

Normally, yes (unless your command procedure
does something inappropriate, like, say, use
a fixed name for a temporary file).

> [...] something like multithreading [...]

More like multiprocessing.
Jess Goodman
Esteemed Contributor

Re: How to control execution time of DCL commands

Here's a command file we use for this problem. Right before the FTP command spawn this commmand file like this:
$ PID = F$GETJPI(0,PID)
$ SPAWN /PROCESS=SUB_'PID' -
@PROCESS_WATCHER 'PID' 00:05:00
$ COPY/FTP ...
$ STATUS = $STATUS
$ STOP SUB_'PID'
$ IF (.NOT.STATUS) THEN ...

$!----------PROCESS_WATCHER.COM--------
$ SET NOON
$ WATCHED_PID := 'P1' !Pass process ID in as P1
$ IF (WATCHED_PID .EQS. "") THEN WATCHED_PID = F$GETJPI(0,"MASTER_PID")
$ P2 = P2-"+" !Pass max wait time in as P2 w or w/o +
$ IF (P2 .EQS. "") THEN P2 = "00:02:00"
$ END_CTIME = F$CVTIME("+''P2'")
$ IF (.NOT.$STATUS) THEN END_CTIME = F$CVTIME("+00:02:00")
$ INTERVAL := 'P3' !Interval between checking for new I/O
$ IF (INTERVAL .EQS. "") THEN INTERNVAL := 00:00:30
$!----------------
$! PRIME DATA
$!-----------
$ CURBIO = F$GETJPI(WATCHED_PID,"BUFIO")
$ IF (.NOT.$STATUS) THEN EXIT
$ CURDIO = F$GETJPI(WATCHED_PID,"DIRIO")
$LOOP:
$ LASTBIO = CURBIO
$ LASTDIO = CURDIO
$ WAIT 'INTERVAL'
$!--------------------
$! CHECK CURRENT INFO
$!--------------------
$ CURDIO = F$GETJPI(WATCHED_PID,"DIRIO")
$ CURBIO = F$GETJPI(WATCHED_PID,"BUFIO")
$ DIO = CURDIO - LASTDIO
$ BIO = CURBIO - LASTBIO
$! If no I/O occured or if this has been going on too long kill our master.
$ IF ( (DIO.GT.0 .OR. BIO.GT.0) .AND. -
F$CVTIME() .LTS. END_CTIME ) THEN GOTO LOOP
$ FEXIT /ID='WATCHED_PID'
$ EXIT
$! this process is spawned from a command procedure that
$! is doing an inline COPY/FTP or another FTP process.
$! it could be any process really.
$! it will wait the time in P2 and FEXIT the process ID in P1
$! passed in as p2 if wait time is reached or no I/O in any P3 interval.
$!----------------------------------------------------------
I have one, but it's personal.
JVK_1
New Member

Re: How to control execution time of DCL commands

Hi Jess,

I have tried out your solution. Actually am new to DCL coding.
I'm getting the following error after executing the above command procedure.

$ FEXIT /ID=00036D43
%DCL-W-IVVERB, unrecognized command verb - check validity and spelling
\FEXIT\

Thanks in advance for the help.

Regards,
Vijay.
Wim Van den Wyngaert
Honored Contributor
Solution

Re: How to control execution time of DCL commands

Must be about the same ad STOP. Just replace FEXIT by STOP.

Wim
Wim