3.2.4 Specifying what is to be executed by a job from the command line
If you use the -r option of the adshexec command to specify on the command line any commands that can be described in a job definition script file, such as standard shell commands and UNIX-compatible commands, you can execute the commands without having to create a job definition script file. To specify the pwd command, which is a standard shell command, on the command line, execute the following adshexec command:
adshexec -r pwd
You can specify on the command line any contents that can be described in a job definition script file, such as multiple commands delimited by the command separator. The following adshexec command specifies multiple commands on the command line:
adshexec -r "export DATA=file01 ; pgm001"
If you specify any spaces on the command line, you must enclose the command line specification in single or double quotation marks (' or "). Because metacharacters, such as $, *, and the semicolon (;), are expanded, depending on the shell used to execute the adshexec command, you must enclose them in single or double quotation marks (' or ") or use an escape character (\). To specify metacharacters, execute the adshexec command as follows:
- In UNIX:
When an escape character is specified
Entered command:
adshexec -m MINIMUM -r "A=(1 2 3); echo \${A[@]}"
Output results:
1 2 3
When no escape character is specified
Entered command:
adshexec -m MINIMUM -r "A=(1 2 3); echo ${A[@]}"
Output results:
Nothing is output.
Output of positional parameter $0 (when an escape character is specified)
Entered command:
adshexec -m SIMPLE -r "echo \$0"
Output results:
adshexec
Output of positional parameter $0 (when no escape character is specified)
Entered command:
adshexec -m SIMPLE -r "echo $0"
Output results:
-bash
adshexec receives the contents obtained by converting positional parameter $0 by the login shell. If the login shell is bash, -bash is output.
- In Windows:
When an escape character is specified
Entered command:
adshexec -m MINIMUM -r "A=(1 2 3); echo \${A[@]}"
Output results:
${A[@]}
When no escape character is specified
Entered command:
adshexec -m MINIMUM -r "A=(1 2 3); echo ${A[@]}"
Output results:
1 2 3
Output of positional parameter $0 (when an escape character is specified)
Entered command:
adshexec -m SIMPLE -r "echo \$0"
Output results:
$0
Output of positional parameter $0 (when no escape character is specified)
Entered command:
adshexec -m SIMPLE -r "echo $0"
Output results:
adshexec
Note the following about executing the adshexec command with the -r option specified:
If you want to use the execution results of the command line in other programs or output the execution results of the command line to the console or files, also specify -m SIMPLE or -m MINIMUM at the same time.
Collection of coverage information by the -t or BATCH_CVR parameter is not supported.
-r CMDLINE is output for the following part of a path that indicates the path name of the job definition script file:
Path name of the job definition script file that is output to the script image file
Path name of the job definition script file that is output to the operation information for the job definition script
Path name of the job definition script file that is displayed in message text output by the job controller
The $0 positional parameter stores executable program name adshexec.
Spool directories are created when a command is executed with the -r option specified. Spool job directories are created only when the -r option is specified as the root job. Note that frequent execution of a command with the -r option specified increases the number of spool jobs in the spool.