Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Automatic Job Management System 3 System Design (Work Tasks) Guide


7.8.3 Checking the return code of a job

You can check the return code of a job in the Monitor Details - [unit-name] dialog box of JP1/AJS3 - View, or from the value of EXITCODE in the job information output by the jpqjobget command. Under normal circumstances, 0 is set as the return code when a job terminates normally. If the job terminates abnormally, the return code of the job process is set. However, in the following cases, the return code is set by JP1/AJS3.

Table 7‒12: Return codes set by JP1/AJS3 and associated conditions

Condition

Return code set by JP1/AJS3

If one of the following statuses occurs in a QUEUE job for which JP1/AJS3 is specified as a host, a PC job, a Unix job, an action job, or a custom job:

  • Failed to start

  • Killed (including jobs killed due to their timeout period elapsing)

  • Ended abnormally#

-1

If an unexpected JP1/AJS3 error occurs during execution of a Unix job.

255

#

If a problem occurs during post-processing by JP1/AJS3 after a job process has terminated (for example, if the result file could not be transferred to the manager host), the return code of the job process is overwritten with -1 by JP1/AJS3 and the job process terminates abnormally.

Cautionary note

For a PC job, the started job process itself can return the return code -1. For a Unix job, if a job returns a negative value, the return code is assumed to be the returned value plus 256. For example, if a job process ends with -1, the return code is 256 - 1 = 255. In a user application, if you need to determine whether the return code was set by the job process or JP1/AJS3, do not use a return code of -1 or 255 in your user applications.

For details about the return codes set while an event job or action job is being executed (from the start to end of the job process), see A. Return Values from Event Jobs and Action Jobs.

In some cases the return code of a job is set by the OS, rather than by a user application or JP1/AJS3. The following table gives examples of typical return codes. Because upgrading your OS might change these return codes, check the technical information for your OS.

Table 7‒13: Examples of return codes set by the OS

OS

Return code

Cause

Action to take

Windows

259 or -1

The process might have failed to open the results file. In this case, one of the following occurs:

  • Message KAVU3284-W is output: A system call error occurred in the internal process (logical-host-name) (reason module: reason-module, reason code 1: 0x2013000a, system call name: CreateFile, reason code 2: reason-code-2)

  • The following message is output to the standard error output: The process cannot access the file. The file is being used by another process.

As the standard output file or standard error output file when you register a job, do not specify a file opened from within a program executed as a job or opened by redirection from a batch file. However, where the file is opened from within the program by a function call, you can work around the problem by opening the file with a setting that permits shared read and write modes.

128

There might be a desktop heap shortage. If so, one of the following messages is output:

  • XXXX.XXX - application error: application not initialized correctly; or

  • Failed to initialize XXXX.XXX

To reduce use of the desktop heap, use the same user account as the JP1/AJS3 service to execute jobs.

UNIX

Signal number + 128

A program started from a job process might have received a signal.#

Take one of the following actions:

  • Set up the program started from a job process so that it does not receive signals.

  • Set up a signal handler or similar for the program to provide additional processing that sets signal-dependent return codes.

#

If the job process itself receives a signal, jobs with Standard specified as the execution service will change to the Killed status with the return code -1. Jobs with Queueless Agent specified as the execution service will change to Ended abnormally status with the return code -1.