9.4.3 adshcmdrc command (defining the return code threshold of a command)
Syntax
adshcmdrc command-name threshold
Description
To treat the command as having ended normally despite the return code of the command executed from the job definition script being other than 0, define the value consisting of the target command name and threshold. Accordingly, cases when the return code of the command is not greater than the threshold value will be interpreted as the command having ended normally. If the command that is specified for the argument finishes by receiving a signal, the command specified for the argument ends in an error. You can specify a maximum of 4095 adshcmdrc commands.
The effective range of the definition of this command is as follows:
-
This command is valid with executions of the job definition script at positions after specification of the command.
-
If there are two or more definitions for the same command, the definition closer to the target command will be valid.
-
If you specify the command outside the job step, the command is valid for the entire job definition script.
-
If you specify the command within the job step, the command is valid from the specified position to the end of the job step.
Arguments
- command-name ~ <Command name> ((1 to 255 bytes))
-
This command specifies the command name that defines the return code to be treated as normal termination. In Windows, you can specify the command name with an extension. You cannot specify the command path. Types of commands that can be specified are as follows: Other commands become targeted if other processes have been executed (using pipe, command substitution, |&, or &).
-
External commands
-
UNIX-compatible commands
-
Shell operation commands
-
Scripts that have been executed as a command (executed with #!)
-
Child jobs
-
Functions (only if FUNCTION is specified for the operand of the CMDRC_CMDGRP_CHECK parameter)
If the extension of the command name is omitted in Windows, the command and batch file having the same name as the specified name become subject to control of the threshold regardless of extension. If you specify a command that includes a space in Windows, enclose the command with " (double quotation marks).
-
- threshold ~ <integer> ((-1 to 255))
-
Defines the threshold value that is treated as a normal termination in the return code. If the return code is larger than the threshold value specified here, the command is considered to have been terminated with an error.
If -1 is specified, the result is always terminated with an error.
If 255 is specified, the result is always normally terminated.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
1 |
Termination with an error |
Notes
-
This command is applied to variable replacement and the command name after solving the alias.
-
If you define the return code threshold that is determined as a normal termination of the job definition script that is executed as a child job, use the CHILDJOB_EXT parameter or CHILDJOB_SHEBANG parameter for the definition of the child job. If you define a child job by using the CHILDJOB_PGM parameter, this job will not be considered as a subject of the return code threshold.
-
When FUNCTION is specified for the CMDRC_CMDGRP_CHECK parameter, you can define the return code threshold that is considered as a normal termination by specifying the function name for the command name of the argument. When the CMDRC_CMDGRP_CHECK parameter is not specified or NONE is specified for the CMDRC_CMDGRP_CHECK parameter, the parameter is processed as the command name having the same name even when a function name is specified for the command name of the argument.
-
When FUNCTION is specified for the CMDRC_CMDGRP_CHECK parameter, the definition of the adshcmdrc command specified in the function will not be enabled. When the CMDRC_CMDGRP_CHECK parameter is not specified or NONE is specified for the CMDRC_CMDGRP_CHECK parameter, the definition of the adshcmdrc command that is specified in the function becomes valid for the command of the script that calls the function.
-
When executing the adshcmdrc command as a different process, the definition of the return code threshold that is considered as a normal termination will not be valid for the command calling the script. Do not execute the adshcmdrc command with other processes.
-
When specifying and executing the adshcmdrc command in a child job, the definition of the return code threshold that is considered as a normal termination will not be valid for the command of the script calling the child job. The definition of the return code threshold that is considered as a normal termination is valid only with commands in the child job.
-
The upper limit of the specified quantity is the total of the number of scripts defined for the job definition script file that is specified for the argument of the adshexec command, the . (dot) command called from the script, and the number of external scripts called by the #-adsh_script command. External scripts are inclusive of the scripts called by the nest.
Examples
Defines the threshold value of the return code that UAP considers as being normally terminated. In the following example, if UAP finishes in job step 1 with a return code that is 1 or less, UAP treats this as having terminated normally.
#-adsh_step_start STEP1 adshcmdrc UAP 1 UAP data #-adsh_step_end