Operating System - OpenVMS
1753946 Members
7761 Online
108811 Solutions
New Discussion

Need to write DCL script and submit in batch queue on weekly basis

 
Sumant M Kumar
Frequent Advisor

Need to write DCL script and submit in batch queue on weekly basis

Hello Experts,

 

Please suggest what needs to be corrected/added to execute job on every Friday at 20:00

 

Script attached below

************************************

$set noon
$backup/ignore=inter SMSC$ROOT:[BIN]*.*;* SMSC_TRC0:[RDB_BCK.BIN]
$backup/ignore=inter SMSC$ROOT:[DATA]*.*;* SMSC_TRC0:[RDB_BCK.DATA]
$RMU/BACKUP/ONLINE SMSC_DB_SDB SMSC_TRC0:[RDB_BCK.RBFBKP]CMPLT_DB_BACKUP.RBF
$backup/ignore=inter SMSC$ROOT:[LOG]*.txt;* SMSC_TRC0:[RDB_BCK.ccabackup]
$define/exec SYS$output SMSC_TRC0:[RDB_BCk.netconfig_bkp]netconfig.txt
$ucx sh route
$ucx sh route/perm
$netstat –rn
$ifconfig -a
$deassign sys$output
$submit/noprint/notify/user=system/queue=sys$batch/log=$1$DGA100:[omniscripts]srcbackup.log $1$DGA100:[omniscripts]srcbackup.COM/AFTER="today+7-"/keep

*************************************************************

 

Regards,

SK Mishra

1 REPLY 1
James T Horn
Frequent Advisor

Re: Need to write DCL script and submit in batch queue on weekly basis

Through the years I've found a number of ways (which I will check what I have), but I quickly found this:

The simplest way to resubmit a periodic job is to use a combination
  time. For example:
     $ SUBMIT/AFTER="+7-"

  This will resubmit the job exactly 7 days after the current time.
  The only drawback is the time the job executes will tend to drift
  forward, especially if you wait until the end of the procedure to
  resubmit the job.

  If you really want 7 days from now at 7 am, you can use some DCL to
  derive the absolute time string:

    $ day=F$CVTIME("+7-","ABSOLUTE","DATE")
    $ SUBMIT/AFTER="''day' 07:00"

  or somewhat more briefly (using a combination time), you could use:

    $ SUBMIT/AFTER="TODAY+7-07:00"

  The only drawback here is if your job is delayed until the next day,
  you'll end up getting out of synch. So, if you really must find the
  next Friday to execute, you can use a loop:

    $ NextDay="TODAY"
    $ DayLoop: NextDay = F$CVTIME("''NextDay'+1-","ABSOLUTE","DATE")
    $ Today = F$EDIT(F$CVTIME(NextDay,,"WEEKDAY"),"UPCASE,COLLAPSE")
    $ IF Today .NES. "FRIDAY" THEN GOTO DayLoop
    $ procname = F$ENVIRONMENT("PROCEDURE")
    $ SUBMIT/AFTER="''nextday'+07:00" 'procname'

  Jobs often resubmit themselves as part of the initial processing
  within the batch job.  The batch job can itself use lexical calls
  such as f$environment("PROCEDURE") to acquire the name of the
  currently-executing procedure, and then pass this in as part of
  the SUBMIT command.

  Another approach simply causes the job to resubmit itself daily at a
  specified time, and the job itself then decides to execute the full
  processing (only) if the current day of the week is (say) Thursday.
  (This is logically rather similar to the above-mentioned approach.)

    $ procname = F$ENVIRONMENT("PROCEDURE")
    $ SUBMIT/AFTER="TOMORROW+07:00" 'procname'
    $ Today = F$EDIT(F$CVTIME(NextDay,,"WEEKDAY"),"UPCASE,COLLAPSE")
    $ IF Today .NES. "FRIDAY" THEN EXIT

  For information on specifying the date and time, please see the HELP
  DCL_Tips Date_Time area in recent HELP libraries, or the similar HELP
  Specify area in older HELP libraries.

  On the other hand, you could use one of the many scheduling products
  available to solve this, and many other scheduling issues.