Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


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:

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.

Table 5‒39: 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

  • Executes a job step if its run attribute is abnormal or always.

  • Does not execute any commands or control statements other than the above.

Error in a standard shell command (resumable)

  • Does not execute a job step if its run attribute is normal.

  • Executes all commands and control statements other than the above.

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.

Table 5‒40: 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

Legend:

Y: Executed.

N: Not executed.

E: Results in an error.

--: Not applicable.

Note:

A row that is blank in the Example of coding in the job definition script column means that nothing is specified.

(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.

Table 5‒41: 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)#

  • Does not execute any commands or control statement inside the job step normal block.

  • Executes the job step error block, if defined.

  • The job step terminates with an error. The processing of subsequent commands and control statements is the same as when an error occurs in an extended script command outside the job step.

Error in a standard shell command (not resumable)

Terminates execution of the job definition script.

#

If the onError attribute is cont and the error (resumable) resulted from the last standard shell command inside the job step, JP1/Advanced Shell assumes that an error occurred inside the job step normal block.

The following table provides examples of errors inside the job step normal block.

Table 5‒42: 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

Legend:

Y: Executed.

N: Not executed.

E: Results in an error.

--: Not applicable.

Note:

A row that is blank in the Example of coding in the job definition script column means that nothing is specified.

(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.

Table 5‒43: Processing in the event of an error inside the job step error block

Type of error

Processing of subsequent commands and control statements

Error in an extended script command

  • Does not execute any command or control statement inside the job step error block.

  • The job step terminates with an error. The processing of subsequent commands and control statements is the same as when an error occurs in an extended script command outside the job step.

Error in a standard shell command (resumable)

  • Executes all commands and control statements inside the job step error block.

  • The job step terminates with an error. The processing of subsequent commands and control statements is the same as when an error occurs in an extended script command outside the job step.

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.

Table 5‒44: 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

Legend:

Y: Executed.

N: Not executed.

E: Results in an error.

--: Not applicable.

Note:

A row that is blank in the Example of coding in the job definition script column means that nothing is specified.

(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.