5.8.11 Notes about output of command execution results
The following notes apply to checking command execution results that are output to a job execution log file.
- Organization of this subsection
(1) Output of command execution results when commands are grouped by a separate program
A group of commands enclosed in parentheses (( and )) is executed as a single job definition script in a separate process. For the command execution results, one of the following messages is output as the execution result of a single job definition script:
KNAX6540-I, KNAX6541-E, KNAX6542-E, KNAX6560-I, KNAX6561-E, KNAX6562-E
(2) Notes about background execution
The following notes apply to output of the termination message for a command that is executed in the background by specifying & or |&:
-
A termination message is always output because the job terminates after all the commands executed in the background have terminated.
-
A command started within a job step might not terminate until after the job step has terminated. In such a case, the termination message for the command is output after the termination message for the job step that started the command. The return code of a command executed in the background by specifying & or |& has no effect on the return code of the job step and job.
-
The order in which information about commands executed in the background is output to the job execution logs is undefined regardless of the actual order in which the processes started and terminated. The same applies to a group of commands linked with the vertical bar (|).
(3) Notes about the builtin, command, eval, time, . (dot), and exec commands
The following notes apply to the execution results of the builtin, command, eval, time, . (dot), and exec commands.
-
Built-in builtin, command, eval, time, and exec commands
JP1/Advanced Shell outputs only the execution results of commands executed as arguments. The execution results of the builtin, command, eval, time, and exec commands are not actually output. The execution results of these commands are not used to evaluate whether the job or job step resulted in normal termination or error termination.
If an option that is not supported by the platform being used is specified for the command command, JP1/Advanced Shell outputs the execution results of the command command and then evaluates whether the job and job step resulted in normal termination or error termination.
-
Built-in . (dot) command
JP1/Advanced Shell outputs only the execution results of each command in a specified external script.
The . (dot) command itself terminates normally, but its execution results are not output. The termination results of the . (dot) command are not used to evaluate whether the job or job step resulted in normal termination or error termination.
If the specified external script did not exist and the . (dot) command terminated with an error, JP1/Advanced Shell outputs the execution results of the . (dot) command and then evaluates whether the job or job step resulted in normal termination or error termination.
(4) Differences in the output of command execution results depending on the command format
If you execute commands using the following formats, the command names before conversion are output to the command execution results:
-
Execution of separate processes by using pipes (|)
-
Execution of separate processes by using command substitution ($(), ``)
-
Execution of background processes by using |&
-
Subshell execution by using command grouping
-
Background execution by using &
The following shows examples.
-
If a variable is executed as a command, the character string before the variable is expanded is output as the command name.
- Definition in the job definition script:
-
01: $CMD &
- Output execution results:
-
KNAX6116-I Execution of the command $CMD (line=1) finished successfully. exit status=0 execution time=0.001s CPU time=0.000s
-
If a character string that satisfies the rule defined in the CHILDJOB_PGM parameter in the environment file is executed as a command, the character string before it was replaced by the CHILDJOB_PGM parameter is output as the command name.
- Definition in the environment file:
-
#-adsh_conf CHILDJOB_PGM /bin/sh
- Definition in the job definition script:
-
01: /bin/sh ./test.ash &
- Output execution results:
-
KNAX6116-I Execution of the command /bin/sh (line=1) finished successfully. exit status=0 execution time=0.008s CPU time=0.000s