27-Apr-2009

$ SET RESTART_VALUE

A little used feature of DCL appears to be the $ SET RESTART_VALUE command. This is a pity, as this is an extremely useful technique to know if you wish to guarantee that a command procedure will always run, despite system crashes or operator intervention.

There are a number of bits and pieces involved with this. Let's look at them one by one.

Firstly (and perhaps most obviously), to get a command procedure to restart after a queue is stopped and started, you need to submit the job with the /RESTART qualifier. This is the non-default behaviour, so you must specify the qualifier with the SUBMIT command.

Secondly, you can use some DCL symbols in your command procedure to determine what the procedure does in the event of a restart. These symbols are $RESTART and BATCH$RESTART.

The $RESTART symbol is set to true or false by DCL, depending on whether or not the command procedure has been restarted. For example, when you first submit the job, this symbol will test false. But if the job is stopped, either by a systems crash or a STOP/QUEUE/RESET or a STOP/QUEUE/REQUEUE, the symbol will test true.

And lastly, if you can accomplish parts of the processing and withstand an intervening restart, you can use the SET RESTART_VALUE command to establish "checkpoints" in the command procedure. The command procedure can then check to see if it has been restarted, and skip the already completed parts of the job, resuming at the latest checkpoint.

Here's an example.


$       if $restart
$       then
$           goto 'batch$restart'
$       endif
$step1:
$       set restart_value=step1
$! do some stuff
$!
$step2:
$       set restart_value=step2
$! do some more stuff
$!
$exit:
$       exit

Posted at April 27, 2009 12:32 PM
Tag Set:

Comments are closed