Need to write DCL script and submit in batch queue on weekly basis (304 Views)
Reply
Frequent Advisor
Sumant M Kumar
Posts: 59
Registered: ‎04-06-2009
Message 1 of 2 (304 Views)

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

Frequent Advisor
James T Horn
Posts: 69
Registered: ‎12-02-2003
Message 2 of 2 (267 Views)

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.

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.