Function
Causes a named command to be implemented whenever the condition specified at the first parameter occurs.
Format
WHENEVER condition,command
where condition can be one of COMMAND ERROR (COMERR), BREAKIN or FINISH
For system issued jobs only, an extra form of the WHENEVER command is
available:
WHENEVER FINISHED,command
This version of the command enables system issued jobs to continue to
run and take their own FINISH action after all user jobs have
finished.
Forbidden contexts
None
A WHENEVER command can be issued only from a job description file or
macro definition file.
Execution
A WHENEVER command supercedes any previous WHENEVER command of the same format issued at the same command processor level. It will also be effective at lower command processor levels if no WHENEVER commands have been issued at these levels. If, however, a WHENEVER command is issued at a lower level, it will be effective at that level. A WHENEVER command can never be effective at a higher level than the level at which the command is issued, because this level is erased when the command processor returns to a higher level. When this happens the last WHENEVER command to be set at the higher level becomes effective. A WHENEVER command is only effective for one command error or other WHENEVER condition; when the specofied event occurs, the WHENEVER condition is switched off before the named command is implemented.
Examples
WHENEVER COMMAND ERROR,GOTO 1
WHENEVER COMMERR,SAVE PROGFILE
WHENEVER BREAKIN,GO 2
WHENEVER FINISH,GO 3A (note that this event occurs if the operator types
a FINISH command other than
FINISH NOW)
Error Messages
An error in the condition (COMMAND ERROR, COMERR, BREAKIN or FINISH)
produces the standard error messages
PARAMETER FORMAT ERROR z
CONDITION PARAMETER MISSING
A WHENEVER which is issued from a source other than a job description
or macro definition file produce the error message
ONLY ALLOWED IN A MACRO DEFINITION FILE
For the above error conditions, the WHENEVER command is never set and is subsequently ignored by GEORGE. An error in the command after the separator produces the relevant error message for that command if and when an attempt is made to obey it. For a WHENEVER COMERR command, the command is subsequently ignored, and the command processor goes to the command after the last command to be obeyed at the level at which the WHENEVER command was set. In this way the possibility of circularity is avoided. For a WHENEVER BREAKIN command, the command is subsequently ignored and the standard command error procedure is followed, that is, a search will be made for a WHENEVER COMMAND ERROR effective at that level. When action is taken on a WHENEVER of either format where there is no command following the condition, the command processor immediately goes to the command after the last command to be obeyed at the level at which this WHENEVER command was set.
Notes