Hitachi

JP1 Version 11 Job Management: Getting Started (Scripting Language)


2.2.1 Defining the return code in the event of an unresumable error in a job

If a job is terminated due to an error, such as a memory shortage or a job definition script parsing error, the job controller's return code is set to 1. You can change this return code to any value from 1 to 255 by setting a value in the ADSH_JOBRC_FATAL environment variable.

For details about setting method and applicability of the ADSH_JOBRC_FATAL environment variable, see ADSH_JOBRC_FATAL environment variable in JP1/Advanced Shell.

Organization of this subsection

(1) ADSH_JOBRC_FATAL environment variable (specifies the return code in the event of an unresumable error in jobs)

The ADSH_JOBRC_FATAL environment variable is used to specify the job controller's return code in the event a job becomes unresumable and is terminated with an error. The specified end code is applied to jobs that are executed by using the adshexec command.

The following shows how to apply the value of this environment variable globally in the entire system:

If this environment variable is not specified and a job terminates with an unresumable error, the controller's return code is set to 1.

(a) Values permitted in the environment variable

termination-code ~<unsigned integer> ((1 to 255))

Specifies the return code to be set when a job cannot be resumed. If the value is padded with leading zeros such as 001, the leading zeros are deleted and the value is treated as being 1.

(b) Notes

  • If the ADSH_JOBRC_FATAL environment variable is defined by using the export parameter in the environment file or the ADSH_JOBRC_FATAL environment variable is defined or changed within a file or a job definition script specified in the ENV shell variable, this functionality does not take effect within that job. The functionality takes effect on another job that is started from that job.

  • The ADSH_JOBRC_FATAL environment variable defines the final return codes for jobs. It does not affect the return codes of individual commands and job steps.

  • If any of the following values is set, the job terminates, without being executed, with an error with return code 255:

    • Value consisting of four or more characters (example: 1234)

    • Value outside the permitted range (example: 500)

    • Non-numeric characters (example: 1A4, +8, 8.0)

    • Value consisting of no character (null character string)

  • Whether the ADSH_JOBRC_FATAL environment variable is applied in the event of an error depends on each job. If an unresumable error occurs only within a root job or a child job, the ADSH_JOBRC_FATAL environment variable will not be applied to any other root job or child job to change its return code.