Hitachi

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


5.8.8 Return codes of jobs, job steps, and commands

This subsection explains the return codes and the normal and abnormal execution results.

Organization of this subsection

(1) Return codes of jobs

The return code of a job is the return code of the last job definition script that executed.

JP1/Advanced Shell does not identify whether job execution results are normal or abnormal. It returns the return codes to other programs such as JP1/AJS as is.

If a job is executed from JP1/AJS, the JP1/AJS job's return code that can be checked by using a program such as JP1/AJS - View might be the JP1/AJS-defined return code, not the adshexec command's return code. In such a case, the JP1/AJS job's return code might differ from the JP1/Advanced Shell job's return code that is output to job execution logs.

Example:

If the adshexec command of a UNIX edition started from JP1/AJS receives SIGINT, JP1/Advanced Shell job's return code is 130, but JP1/AJS job's return code is -1.

If an error occurs in a job, an error message is output.

(2) Return codes of job steps

The return code of a job step is the return code of the last command executed in the job step normal block. If you execute the exit command with the argument specified in the job step error block, you can set the argument of the exit command as the job step's return code. The return codes of other commands executed in the job step error block have no effect on the job step's return code. The following explains normal termination and error termination of job steps:

(3) Return codes of external commands

The return codes are predefined for each external command.

Although the range of values that the external commands can return depends on the platform and the programming language specifications used for the external commands, we recommend that you use a range from 0 through 255. If the value is outside this range, JP1/Advanced Shell uses the following value as the external command's return code:

UNIX

The trailing eight bits of the value returned by the external command

Windows
  • If the value returned by the external command is 0 or greater: the trailing eight bits of the value

  • If the value returned by the external command is less than 0: 255

  • If the external command terminated due to an exception:# the trailing eight bits of the exception code

#

The following table explains the exception codes that are treated as exceptions.

Table 5‒38: Exception codes treated as exceptions and their meaning

No.

Exception code

Meaning

1

0xC0000005

The thread attempted to access a virtual address for which access permissions are not granted.

2

0x80000003

A breakpoint has been reached.

3

0x80000002

An attempt was made to access misaligned data on hardware with memory access-related alignment rules (for example, a 16-bit value spanning a two-byte boundary and a 32-bit value spanning a four-byte boundary are not permitted).

4

0x80000004

This indicates execution of a single instruction at a time by using a trace or single-step method.

5

0xC000008C

Hardware detected an attempt made by the thread to access data outside the range of an array.

6

0xC000008D

In a floating-point operation, at least one of the operands is an unnormalized number (the value is too small to express in the normal floating-point format).

7

0xC000008E

The thread attempted to perform division by zero during a floating-point operation.

8

0xC000008F

The accurate value could not be obtained from a floating-point operation.

9

0xC0000030

An exception of to a floating-point operation other than an exception listed in this table occurred.

10

0xC0000091

As a result of a floating-point operation, the value of the exponent part was above the permitted range.

11

0xC0000032

As a result of a floating-point operation, a stack resulted in overflow or underflow.

12

0xC0000033

As a result of a floating-point operation, the value of the exponent part was below the permitted range.

13

0xC0000094

The thread attempted to perform division by zero during an integer arithmetic operation.

14

0xC0000035

An integer arithmetic operation resulted in overflow.

15

0xC0000096

An attempt was made to execute an instruction (privileged instruction) that cannot be executed in the current machine mode.

16

0xC0000025

An attempt was made to re-execute a command that resulted in an unresumable exception.

If the external command execution result is any of the ones listed in the following table, JP1/Advanced Shell assumes that the corresponding external command terminated with an error.

External command execution result

Return code

The external command's return code is not 0 (this value can be changed with the successRC attribute and with the CMDRC_THRESHOLD_USE_PRESET and CMDRC_THRESHOLD_DEFINE parameters)

External command's return code

The external command was terminated by signal.

Return code for signal termination that is predefined by the external command

The specified external command could not be executed due to a lack of execution permissions.

126

The specified external command could not be executed because it did not exist.

127

The external commands specified in the #-adsh_rc_ignore command will not result in an error regardless of the return code.

(4) Termination codes of built-in commands

The termination codes of built-in commands depend on the command. Whether a built-in command terminated normally or resulted in an error is determined based on any error event that occurred during command execution, not on the value of the termination code. Note that a built-in command specified in the #-adsh_rc_ignore command always terminates normally regardless of the command's execution results.

For details about the conditions that determine whether each command has terminated normally or resulted in an error, see the termination codes for each command described in 9. Job Definition Script Commands and Control Statements.

(5) Notes

The return code of UNIX-compatible commands and user-created commands might not be 0 even if they terminate normally. For example, the diff command terminates with code 1 when the compared files differ.

To correctly determine whether such commands terminated normally or with an error, use the methods described below to code your job definition scripts. For details about the return codes of UNIX-compatible commands, see 8.4 UNIX-compatible commands.

(a) Specifying in the environment setting parameters

  • To correctly determine whether UNIX-compatible commands terminated normally or with an error, specify ENABLE in the CMDRC_THRESHOLD_USE_PRESET parameter.

  • To correctly determine whether OS-provided commands or user-created commands terminated normally or with an error, specify the CMDRC_THRESHOLD_DEFINE parameter.

(b) Specifying in job definition scripts

  • To set a command to always terminate normally, specify the name of that command in the argument of the #-adsh_rc_ignore command.

  • To determine whether a command terminated normally or with an error according to the command specifications, define the corresponding command in a job step and specify the return code for normal termination with the successRC attribute. The specified successRC attribute takes effect on all commands that are executed within the corresponding job step.