5.8.10 Processing in the event of an error during job execution
This subsection explains how commands and control statements are handled when an error occurs during job execution. The following types of errors can occur:
-
Errors in extended script commands
This type of error occurs when file allocation by the #-adsh_file command fails.
-
Errors in standard shell commands
-
If the processing is resumable
This type of error occurs when a specified command name cannot be found or a regular built-in command results in an error.
-
If the processing is not resumable
This type of error occurs when a special built-in command results in an error.
-
- Organization of this subsection
(1) Errors outside job steps
The following table explains the processing in the event of an error outside the job step.
Type of error |
Processing of subsequent commands and control statements |
---|---|
Error in an extended script command |
|
Error in a standard shell command (resumable) |
|
Error in a standard shell command (not resumable) |
Terminates execution of the job definition script. |
The following table provides examples of errors outside job steps.
Example of coding in the job definition script |
Error in extended script command |
Error in standard shell command |
|
---|---|---|---|
Resumable |
Not resumable |
||
#-adsh_file JOBFILE jobfile |
E |
-- |
-- |
cmdA |
N |
E |
-- |
shift $n |
N |
Y |
E |
cmdB |
N |
Y |
N |
-- |
-- |
-- |
|
#-adsh_step_start NO -run normal |
N |
N |
N |
echo "run normal step" |
N |
N |
N |
cmdNormal |
N |
N |
N |
#-adsh_step_end |
N |
N |
N |
-- |
-- |
-- |
|
#-adsh_step_start AB -run abnormal |
Y |
Y |
N |
echo "run abnormal step" |
Y |
Y |
N |
cmdAbnormal |
Y |
Y |
N |
#-adsh_step_end |
Y |
Y |
N |
-- |
-- |
-- |
|
#-adsh_step_start AL -run always |
Y |
Y |
N |
echo "run always step" |
Y |
Y |
N |
cmdAlways |
Y |
Y |
N |
#-adsh_step_end |
Y |
Y |
N |
(2) Errors inside the job step normal block
The following table explains the processing in the event of an error inside the job step normal block.
Type of error |
Processing of subsequent commands and control statements |
---|---|
Error in an extended script command Error in a standard shell command (resumable)# |
|
Error in a standard shell command (not resumable) |
Terminates execution of the job definition script. |
The following table provides examples of errors inside the job step normal block.
Example of coding in the job definition script |
Error in extended script command |
Error in standard shell command |
||
---|---|---|---|---|
Resumable |
Resumable (onError attribute is cont) |
Not resumable |
||
#-adsh_step_start S1 -onError stop |
-- |
-- |
-- |
-- |
#-adsh_file JOBFILE jobfile |
E |
-- |
-- |
-- |
cmdA |
N |
E |
E |
-- |
shift $n |
N |
N |
Y |
E |
cmdB |
N |
N |
Y |
N |
#-adsh_step_error |
Y |
Y |
N |
N |
echo "step error block" |
Y |
Y |
N |
N |
#-adsh_step_end |
Y |
Y |
Y |
N |
-- |
-- |
-- |
-- |
|
#-adsh_step_start NO -run normal |
N |
N |
Y |
N |
echo "run normal step" |
N |
N |
Y |
N |
cmdNormal |
N |
N |
Y |
N |
#-adsh_step_end |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
|
#-adsh_step_start AB -run abnormal |
Y |
Y |
N |
N |
echo "run abnormal step" |
Y |
Y |
N |
N |
cmdAbnormal |
Y |
Y |
N |
N |
#-adsh_step_end |
Y |
Y |
N |
N |
-- |
-- |
-- |
-- |
|
#-adsh_step_start AL -run always |
Y |
Y |
Y |
N |
echo "run always step" |
Y |
Y |
Y |
N |
cmdAlways |
Y |
Y |
Y |
N |
#-adsh_step_end |
Y |
Y |
Y |
N |
(3) Errors inside the job step error block
The following table explains the processing of subsequent commands and control statements in the event of an error in the job step error block.
Type of error |
Processing of subsequent commands and control statements |
---|---|
Error in an extended script command |
|
Error in a standard shell command (resumable) |
|
Error in a standard shell command (not resumable) |
Terminates execution of the job definition script. |
The following table shows examples of errors inside the job step error block.
Example of coding in the job definition script |
Error in extended script command |
Error in standard shell command |
|
---|---|---|---|
Resumable |
Not resumable |
||
#-adsh_step_start S1 -onError stop |
-- |
-- |
-- |
echo "step normal block" |
-- |
-- |
-- |
#-adsh_step_error |
-- |
-- |
-- |
#-adsh_file JOBFILE jobfile |
E |
-- |
-- |
cmdA |
N |
E |
-- |
shift $n |
N |
Y |
E |
cmdB |
N |
Y |
N |
#-adsh_step_end |
Y |
Y |
N |
-- |
-- |
-- |
|
#-adsh_step_start NO -run normal |
N |
N |
N |
echo "run normal step" |
N |
N |
N |
cmdNormal |
N |
N |
N |
#-adsh_step_end |
N |
N |
N |
-- |
-- |
-- |
|
#-adsh_step_start AB -run abnormal |
Y |
Y |
N |
echo "run abnormal step" |
Y |
Y |
N |
cmdAbnormal |
Y |
Y |
N |
#-adsh_step_end |
Y |
Y |
N |
-- |
-- |
-- |
|
#-adsh_step_start AL -run always |
Y |
Y |
N |
echo "run always step" |
Y |
Y |
N |
cmdAlways |
Y |
Y |
N |
#-adsh_step_end |
Y |
Y |
N |
(4) Notes
If a resumable error occurs in a standard shell command outside the job step, all subsequent commands and control statements are executed except for a job step whose run attribute is normal. In this case, the job's return code is overwritten by the return codes of the subsequent commands and control statements. If you want to apply as the job's return code the return code that caused the error (to treat the job as having resulted in an error in JP1/AJS), specify the commands and control statements in the job step with stop as the onError attribute.