Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


9.4.5 adshjoberr command (reports an error to a job and job step)

Syntax

adshjoberr return-code

Description

An error can be reported from the specified job and job step error. Behavior of the command if the specified position is within the job step or outside the job step is as follows:

If you specify the command within the job step:

The succeeding process of the job step normal block is not executed regardless of the onError attribute of the job step. Therefore, the command is executed if the job step error block is defined and the job step finishes with an error.

If you specify the command outside the job step:

If the subsequent job step in which the run attribute is abnormal or always is defined, the command is executed and the job finishes with an error.

Arguments

return-code ~ <integer>((0 to 255))

Define the return code to be reported to a job or job step.

Return codes

Return code

Meaning

0 to 255

Termination with an error

This command reports the return code specified for argument of the adshjoberr command to the job or job step.

1

Termination with an error

Fatal error occurred.

200

Termination with an error

Specification of the command line is wrong.

Notes

Examples

If the file does not exist, forcibly terminate the job step with the return code 1.

Job definition script
#-adsh_job J01

#-adsh_step_start S01
  cmd1
  if [[ ! -a /tmp/tempfile ]]; then
    echo "tempfile not found"
    adshjoberr 1
  fi
#-adsh_step_end
Results
********  JOB CONTROLLER MESSAGE  ********
17:01:22 046276 KNAX0091-I J01 The job started.
17:01:22 046276 KNAX7901-I The job controller will wait for all asynchronous processes at the end of the job.
17:01:22 046276 KNAX7902-I The job controller will run in tty stdin mode.
17:01:22 046276 KNAX0092-I J01.S01 step started.
17:01:22 046276 KNAX6116-I Execution of the command ./cmd1 (line=4) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
17:01:22 046276 KNAX6112-I Execution of the command [[ (line=5) finished successfully. exit status=0 execution time=0.000s CPU time=0.000s
17:01:22 046276 KNAX6112-I Execution of the command echo (line=6) finished successfully. exit status=0 execution time=0.000s CPU time=0.000s
17:01:22 046276 KNAX6150-E An error was reported to "step". (exit status=1, line 7)
17:01:22 046276 KNAX6596-E J01.S01 step failed. exit status=1 execution time=0.002s CPU time=0.000s
17:01:22 046276 KNAX0101-E J01 An error occurred during execution of the job.
17:01:22 046276 KNAX0098-I J01 The job ended. exit status=1 execution time=0.004s CPU time=0.000s