Use the SET RESTART_VALUE command in restartable command procedures. (A
restartable command procedure is a command procedure that is submitted
to run in batch mode with the SUBMIT/RESTART command.) SET
RESTART_VALUE assigns a value to the global symbol BATCH$RESTART, the
location at which the batch job should be restarted after its execution
has been interrupted.
When writing a restartable command procedure, begin each possible
starting point in the command procedure with a label. After the label,
use the SET RESTART_VALUE command to assign the symbol BATCH$RESTART to
equal the label. If the batch job is interrupted by a system crash and
is then restarted, the command procedure can resume execution at the
label pointed to by BATCH$RESTART.
The SET RESTART_VALUE command is used in conjunction with the reserved
global symbol $RESTART. $RESTART is a special symbol that is maintained
by the system and cannot be deleted. $RESTART has the value TRUE if the
batch job has been restarted; otherwise, $RESTART has the value FALSE.
At the beginning of a restartable command procedure, test the value of
the reserved global symbol $RESTART. If $RESTART is true, execute a
GOTO statement using the symbol BATCH$RESTART as the transfer label. If
a SET RESTART_VALUE command was not executed before the batch job was
interrupted, the symbol BATCH$RESTART has no definition and the batch
job should restart from the beginning.
Most of your process environment is not maintained when the system
fails. The only symbols maintained across a system failure are $RESTART
and BATCH$RESTART; therefore, you should redefine any symbols or
process logical names used in your command procedure after each SET
RESTART_VALUE command.
If a command procedure has SET RESTART_VALUE commands in it, but you
want the job to restart at the beginning, enter the SET
ENTRY/NOCHECKPOINT command to delete the global symbol BATCH$RESTART.
In this example, the first command states that, if $RESTART is true,
the procedure is to jump to the value contained in BATCH$RESTART.
($RESTART is true only if the job has been executed before, that is,
the job is being rerun after a crash or after having been requeued.)
The first SET RESTART_VALUE command assigns the label FIRSTPART to be
equal to the symbol BATCH$RESTART. The next line contains the command
to run PART1.EXE.
The second SET RESTART_VALUE command assigns the label SECONDPART to be
equal to the symbol BATCH$RESTART. The last line shown contains the
command to run PART2.EXE.
When the job is first submitted using the SUBMIT/RESTART command, the
value of $RESTART is FALSE, so the IF expression is ignored. If the job
is stopped during the run of PART1.EXE, the value of BATCH$RESTART is
FIRSTPART. When the job is restarted, the value of $RESTART is TRUE;
therefore, the IF expression is processed and transfers control to the
FIRSTPART label in the procedure. PART1.EXE is rerun.
If the job is stopped during the run of PART2.EXE, the value of
BATCH$RESTART is SECONDPART. When the job is restarted, the value of
$RESTART is TRUE. In this instance, the IF--GOTO command transfers
control to the SECONDPART label in the procedure so that PART2.EXE can
be run. PART1.EXE is not rerun.