RECOVERY

Purpose

This statement defines the options to run IBM Workload Scheduler recovery for a job whose status is in error, but whose error code is not FAIL. To run the recovery you can specify one or both of the following recovery actions:
  • A recovery job (JOBCMD or JOBSCR keywords)
  • A recovery prompt (MESSAGE keyword)
The recovery actions must be followed by one of the recovery options (the OPTION keyword), stop, continue, or rerun. The default is stop with no recovery job and no recovery prompt. For more information about recovery in a distributed network, see IBM Workload Scheduler: User's Guide and Reference. The RECOVERY statement is ignored if it is used with a job that runs a centralized script.

Format


1  RECOVERY?  OPTION (
2.1! STOP
2.1 CONTINUE
2.1 RERUN
1 )?  MESSAGE ( "message" )
1  JOBCMD  ( command name )
1  JOBSCR  ( script name )
2?  JOBUSR (  user name )
2?  JOBWS (  workstation name )
2?  INTRACTV (
3.1! NO
3.1 YES
2 )
2?  RCCONDSUC (  "success condition" )

Parameters

OPTION(STOP|CONTINUE|RERUN)
Specifies the option that IBM Z Workload Scheduler must use when a job abends. You can define a recovery option for every job. You can specify one of the following values:
STOP
Do not continue with the next job. The current job remains in error. You cannot specify this option if you use the MESSAGE recovery action.
CONTINUE
Continue with the next job. The current job status changes to complete in the z/OS® interface.
RERUN
Automatically rerun the job (once only). The job status changes to ready, and then to the status of the rerun. Before rerunning the job for a second time, an automatically generated recovery prompt is displayed.
MESSAGE("message")
Specifies the text of a recovery prompt, enclosed in single or double quotation marks, to be displayed if the job abends. The text can contain up to 64 characters. If the text begins with a colon (:), the prompt is displayed, but no reply is required to continue processing. If the text begins with an exclamation mark (!), the prompt is not displayed, but a reply is required to proceed. You cannot use the recovery prompt if you specify the recovery STOP option without using a recovery job.
JOBCMD(command name)
Specifies the name of the shell command to run if the job abends. The maximum length is 4095 characters. If the command includes more than one word, it must be enclosed within single or double quotation marks.
JOBSCR(script name)
Specifies the name of the shell script or executable file to be run if the job abends. The maximum length is 4095 characters. If the script includes more than one word, it must be enclosed within single or double quotation marks.
JOBUSR(user name)
Specifies the name of the user submitting the recovery job action. The maximum length is 47 characters. If you do not specify this keyword, the user defined in the JOBUSR keyword of the JOBREC statement is used. Otherwise the user defined in the CPUUSER keyword of the CPUREC statement is used. The CPUREC statement is the one related to the workstation on which the recovery job must run. If the user is not specified in the CPUUSER keyword, the tws user is used.

If you use this keyword to specify the name of the user that runs the recovery on a Windows fault-tolerant workstation, you must associate this user name to the Windows workstation in the USRREC initialization statement

JOBWS(workstation name)
Specifies the name of the workstation on which the recovery job or command is submitted. The maximum length is four characters. The workstation must belong to the same domain as the workstation on which the main job runs. If you do not specify this keyword, the workstation name of the main job is used.
INTRACTV(YES|NO)
Specifies that the recovery job runs interactively on a Windows desktop. This keyword is used only for jobs running on Windows fault-tolerant workstations.
RCCONDSUC("success condition")
An expression which determines the return code (RC) required to consider a recovery job as successful. If you do not specify this keyword, a return code of zero corresponds to a successful condition. A return code different from zero corresponds to the job abending.

The success condition maximum length is 256 characters and the total length of the JOBCMD or JOBSCR plus the success condition must be 4086 characters. This is because the TWSRCMAP string is inserted between the success condition and the script or command name. For example, the dir command together with the success condition "rc4" is translated into dir TWSRCMAP: RC4.

The success condition expression can contain a combination of comparison and Boolean expressions:

Comparison expression
Specifies the recovery job return codes. The syntax is:
(RC operator operand)
RC
The RC keyword.
operator
Comparison operator. It can have the following values:
Table 1. Comparison operators
Example Operator Description
RC<a < Less than
RC<=a <= Less than or equal to
RC>a > Greater than
RC>=a >= Greater than or equal to
RC=a = Equal to
RC=a = Not equal to
operand
An integer between -2147483647 and 2147483647.
For example, you can define a successful recovery job as a job that ends with a return code less than or equal to 3 as follows:
RCCONDSUC "(RC = 3)"
Boolean expression
Specifies a logical combination of comparison expressions. The syntax is:
comparison_expression operator comparison_expression
comparison_expression
The expression is evaluated from left to right. You can use parentheses to assign a priority to the expression evaluation.
operator
Logical operator. It can have the following values:
Table 2. Logical operators
Example Operator Result
expr_a and expr_b And TRUE if both expr_a and expr_b are TRUE.
expr_a or expr_b Or TRUE if either expr_a or expr_b is TRUE.
Not expr_a Not TRUE if expr_a is not TRUE.
For example, you can define a successful recovery job as a job that ends with a return code less than or equal to 3 or with a return code not equal to 5, and less than 10 as follows:
RCCONDSUC "(RC=3) OR ((RC5) AND (RC10))"