Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


5.8.6 Calling an external job definition script file from an executing job definition script

You can use the #-adsh_script command to insert into a currently executing job definition script file the contents of an external job definition script file as they are when the job controller starts.

Unlike the . (dot) standard shell command, this command expands into the calling job definition script the contents of a specified external script as they are when the job controller starts. JP1/Advanced Shell treats the calling job definition script containing the expanded job definition script as a single job definition script and performs syntax analyses on it.

The following shows an example of an external script definition and a calling job definition script.

The contents of script.ash are equivalent to the following job definition script:

#!/opt/jp1as/bin/adshexec
#-adsh_job JOB001
 
uap01
#-adsh_step_start exS1    <-- The following four lines constitute the expanded exScript.ash
  exUap01
#-adsh_step_end
exUap02
#-adsh_step_start S2 -run normal
  uap2
#-adsh_step_end

If exUap02 in the external script /scripts/exScript.ash terminates with an error (a return code other than 0), because normal is specified for the run attribute of the succeeding job step S2, the job will terminate without the step being executed.

The following table describes the differences between the . (dot) command and the #-adsh_script command.

Table 5‒39: Differences between the . (dot) command and the #-adsh_script command

No.

Comparison item

. (dot) command

#-adsh_script command

1

Handling of extended script commands inside the external job definition script

Handled as comments.

Handled as extended script commands.

2

Output to script images

Not output.

Output

3

Operation when relative paths are specified

Allows specification of relative paths.

However, this command resolves the paths by referencing the value of the PATH environment variable.

Allows specification of relative paths.

However, this command interprets the specified paths as being relative to the current directory used when adshexec started; it does not reference the value of the PATH environment variable.

4

Maximum number of commands permitted in a job

No limit

Maximum of 4,095

5

Command execution from within the external job definition script

Executable

Executable.

However, the command cannot be executed by calling the same external job definition script recursively.

6

Specification of arguments for the external job definition script

Permitted

Not permitted

7

CUI debugger

Setting breakpoints in the external job definition script by using the break command

Cannot set breakpoints.

Can set breakpoints.

8

Displaying information about the functions defined in the external job definition script by using the info functions command

Cannot display information.

However, the information can be displayed once the function definition is completed within the external job definition script.

Can display information.

9

Displaying the contents of the external job definition script by using the list command

Cannot display the contents.

Can display the contents.

10

Information displayed when execution of the job definition script is stopped

Line numbers: Can be displayed.

Lines in the source file: Cannot be displayed.

Command strings: Can be displayed.

Line numbers: Can be displayed.

Lines in the source file: Can be displayed.

Command strings: Can be displayed.

Organization of this subsection

(1) Specifying relative paths

If the relative path of an external script is specified, JP1/Advanced Shell assumes the current directory used when adshexec started, regardless of the processing of the previous job definition script.

A path relative to any other directory cannot be specified. To use such a path, you must specify its absolute path.

The following show a specification example:

Current directory when the adshexec command starts: /scripts
#/opt/jp1as/bin/adshexec
cd /work
#-adsh_script ex_script.ash      <-- /scripts/ex_script.ash is executed.

This example uses the #-adsh_script command to execute the external script file /scripts/ex_script.ash. The current directory was changed by the cd command on the immediately preceding line, but this change has no effect on the path of the external script file that is called.

(2) Specifying absolute paths

If you want to execute /work/ex_script.ash, specify an absolute path as shown in the following.

Current directory when the adshexec command starts: /scripts
#/opt/jp1as/bin/adshexec
cd /work
#-adsh_script /work/ex_script.ash      <-- /work/ex_script.ash is executed.