2.7.2 Defining and executing a jobnet
To automate job execution in JP1/AJS, you can define registered custom jobs, PC jobs (for Windows), UNIX jobs (for UNIX), or GUI application execution jobs into a jobnet in JP1/AJS - View, and then execute the jobnet. For details about JP1/AJS - View, see the description of job definition in the JP1/Automatic Job Management System 3 Operator's Guide.
To define and execute a jobnet in JP1/AJS3 - View:
From the Windows Start menu, select All Programs, JP1_Automatic Job Management System 3 - View, and then Job Management System.
The JP1/AJS3 - View - Login window is displayed.
To log in, specify your user name, password, and the host to connect.
The JP1/AJS3 - View window is displayed.
Select Edit, New, then Jobnet.
The Define Details -[Jobnet] dialog box is displayed.
Specify information including attributes of the jobnet, and then click the OK button.
Specify the appropriate information in Exec-agent according to the operating environment. This information can be omitted. For details about the JP1/AJS items, see the applicable JP1/AJS manual.
The jobnet is created and displayed in the list area.
Double-click the created jobnet.
The Jobnet Editor window is displayed.
Select Exclusive edit so that no other user can access the job while you are defining and associating it.
Drag the required custom job, PC job, or UNIX job icon from the icon list to the map area.
The Define Details - [Custom Job], Define Details - [PC Job], or Define Details - [UNIX Job] dialog box is displayed.
The steps below explain the definition method for custom jobs. For details about the settings required to use PC or UNIX jobs in JP1/Advanced Shell, see 2.7.3 Defining jobs as PC or UNIX jobs.
-
In the Define Details - [Custom Job] dialog box, define information including job attributes.
Specify the appropriate information on the Definition and Attributes pages as described in the applicable JP1/AJS manual. Also specify the appropriate information in Exec-agent according to the operating environment. This information can be omitted.
If either of the following is specified with a PC job or UNIX job, an empty file is output when Standard output is specified in the Definition tab:
-
The -s option is specified in the adshexec command or SPOOL is specified in the OUTPUT_STDOUT parameter in the environment file (the standard output is redirected to spool files).
-
EXTENDED is specified in the OUTPUT_MODE_ROOT parameter (the expansion output mode is selected).
This is because the contents of the standard output are output to a separate file by JP1/Advanced Shell's job controller and nothing is output to the standard output that is returned to JP1/AJS.
-
-
Select the Definition tab, and then click the Details button.
The Define Execution dialog box corresponding to type of custom job appears. Displays for Windows, UNIX, and GUI application execution jobs are as follows:
-
In Windows
-
In UNIX
-
For a GUI application execution job
For more information about steps 9 and 10, also see (2) Supplementary information about the jobnet definition procedure for custom jobs.
-
-
In the Define Script Execution dialog box, specify the information required for execution of the JP1/Advanced Shell job controller, and then click the OK button.
For a PC job or UNIX job
-
Job definition script file ~<path name> Windows: ((1 to 247 bytes)), UNIX: ((1 to 1,023 bytes))
Specifies the name of the job definition script file. This item cannot be omitted.
-
Runtime parameters ~<ASCII character string>((0 to 1,022 bytes))
Defines the parameters that are to be passed when the job definition script file is executed. If you specify multiple parameters, use the space as the delimiter.
-
Job environment file ~<path name> Windows: ((0 to 247 bytes)), UNIX: ((0 to 1,023 bytes))
Specifies the name of the job environment file. When this item is specified, the system uses the specified job environment file, even if the ADSH_ENV environment variable is specified in JP1/Advanced Shell's job controller environment. If this item is omitted but the ADSH_ENV environment variable is defined in JP1/Advanced Shell's job controller environment, the system uses the specified ADSH_ENV environment variable value during execution. If this item is omitted and the ADSH_ENV environment variable is not defined in JP1/Advanced Shell's job controller environment, the system assumes that no job environment file is specified. JP1/Advanced Shell's job controller that was started by JP1/AJS sets the path of the job environment file that it used in the ADSH_ENV environment variable and then starts job execution. If another job controller is started as a descendant process, that job controller uses the value of the ADSH_ENV environment variable.If you start another job controller or any other command that loads a job environment file as a child process, that job controller or command will use the value of the ADSH_ENV environment variable. Therefore, if the value of the ADSH_ENV environment variable is not set during job execution, the job controller uses the same job environment file that was used by JP1/Advanced Shell's job controller that was started by JP1/AJS. If the value of the ADSH_ENV environment variable is set during job execution, the job controller uses the job environment file containing the new value.
-
Logical host
Specifies whether the job is to be executed on a logical host. If the Run on a logical host check box is selected, the job is executed on the logical host specified in JP1/AJS (value of the JP1_HOSTNAME environment variable).
-
Check syntax
Specifies whether the job's contents are to be checked. When the Check job definition script syntax check box is selected, the contents of the job definition script file are checked but the job definition script file is not executed.
For a GUI application execution job
-
Command line ~ <ASCII character string> ((1 to 1,022bytes))
Specifies the file name of the executable application and the specified parameter for execution of the executable application. This parameter cannot be omitted.
-
Path name of the executable application ~ <ASCII character string> ((1 to 247 bytes))
Specifies the path name of the executable application.
-
Argument for the executable application ~ <ASCII character string> ((0 to 1,023 bytes))
Specifies the argument for the executable application.
-
Work folder ~ <path name>((0 to 247 bytes))
This command specifies the work folder for execution of the executable application.
The work folder can be omitted. When the work folder has been omitted, JP1/AJS-Agent (or JP1/AJS-Manager) will become the runtime directory (work directory) used when starting the GUI application execution program. For the runtime directory (work directory) when JP1/AJS-Agent (or JP1/AJS-Manager) starts the job controller of JP1/AS, see "JP1/Automatic Job Management System 3 Configuration Guide.
Name to be displayed ~ <ASCII character string> (0 to 247 bytes) Specifies the name that appears when you left-click on the application execution agent icon. The name to be displayed can be omitted. If the name to be displayed is omitted, the content of the command line will be applied.
-
Action after executable application
This command specifies whether the command will wait for the executable application to finish after the executable application is executed. When an application is executed without placing a check in the Action after executing app. check box, the command will wait for the executable application to finish after the executable application has been executed. When an application is executed upon placing a check in the Action after executing app. check box, the command will not wait for the executable application to finish after the executable application has been executed.
-
Message output
This command specifies whether to suppress message output. When an application is executed upon placing a check in the Suppress output to stderr check box, output of messages to the standard error output will be suppressed.
-
-
Display the Define Details - [Custom Job] dialog box again, and then click the OK button.
The job is defined in the jobnet. If necessary, define another job in the same manner.
-
Associate the jobs according to their execution order.
The jobnet is defined. The following shows an example job definition in JP1/AJS - View.
-
Execute the jobnet by using JP1/AJS.
JP1/Advanced Shell's job controller returns its return code as the job return code to JP1/AJS.
- Organization of this subsection
(1) Notes about jobnet definitions
-
Specification of coverage
If you want to enable coverage from custom jobs, specify the coverage auto-acquisition functionality in the environment file.
Run-time directory to be used when JP1/Advanced Shell's job controller is started from JP1/AJS
When JP1/Advanced Shell's job controller is started from JP1/AJS, the run-time directory is set to the one that is used when JP1/AJS - Agent (or JP1/AJS - Manager) starts JP1/Advanced Shell's job controller. For details about the run-time directory that is used when JP1/AJS - Agent (or JP1/AJS - Manager) starts JP1/Advanced Shell's job controller, see the manual JP1/Automatic Job Management System 3 Configuration Guide. In the JP1/AJS manuals, the run-time directory is referred to as a work path (work directory).
-
Environment variables to be used when JP1/Advanced Shell's job controller is started from JP1/AJS
Normally, when JP1/Advanced Shell's job controller for Windows is started from JP1/AJS, the system environment variable settings are enabled when the JP1/AJS services are started and no user environment variables are loaded. For details, see the applicable JP1/AJS manual.
-
Connecting to an overseas version of JP1/AJS - Manager whose language is set to English
When connecting to an overseas version of JP1/AJS - Manager whose language is set to English, in the Define Script Execution dialog box, in the definition information, use only ASCII alphanumeric characters.
-
Environment variable that is used when JP1/AJS starts the GUI application execution program
Environment variable of the running user is used when JP1/AJS starts the GUI application execution program starts.
(2) Supplementary information about the jobnet definition procedure for custom jobs
With respect to the job execution settings in steps 9 and 10 in 2.7.2 Defining and executing a jobnet, you can also specify the unit definition in the ajsdefine command in JP1/AJS and the job definition in JP1/AJS - Definition Assistant.
For details about the unit definition, see the manual JP1/Automatic Job Management System 3 Command Reference.
For details about JP1/AJS - Definition Assistant, see the manual JP1/Automatic Job Management System 3 - Definition Assistant Description, Operator's Guide and Reference.
The following provides the details of the environment variables and parameters that are specified in the unit definition and JP1/AJS - Definition Assistant when custom jobs are used.
(a) For PC jobs and UNIX jobs
-
Environment variables configured in the Define Execution dialog box of JP1/Advanced Shell
ADSH_AJS_SCRF: Job definition script file name
ADSH_AJS_ENVF: Job environment file name
ADSH_AJS_LHOST: Logical host
ADSH_AJS_GCHE: Precheck
-
Environment variables passed to job controller of JP1/Advanced Shell
Environment variables are defined as env parameters of the unit definition file.
The following table shows the setting items for environment variables passed to the job controller of JP1/Advanced Shell.
Table 2‒28: Setting items for environment variables passed to the job controller of JP1/Advanced Shell Item name
Description
Input range
Number of bytes that can be specified as the value (character string following "=") of an environment variable (Shift-JIS)
Settings
Types of characters that can be defined
-
Character string: Characters other than control characters (0x00 to 0x1f, 0x7f)
-
Symbol name: Half-width alphanumeric characters, "@", "#", and "_"
-
Numeric characters
Initial value
Value loaded when a custom job is started as a new job
Omission
If a required value is omitted, the job controller of JP1/Advanced Shell returns an error.
The following table shows the input range and settings of environment variable items passed to the job controller of JP1/Advanced Shell.
Table 2‒29: Input range and settings of environment variable items passed to the job controller of JP1/Advanced Shell. Environment variable
Input range
Settings
Initial value
Omission
ADSH_AJS_SCRF
PC job: 1 to 247 bytes
UNIX job: 1 to 1,023 bytes
Character string
Null character string
Not permitted
ADSH_AJS_ENVF
PC job: 0 to 247 bytes
UNIX job: 0 to 1,023 bytes
Character string
Null character string
Permitted
ADSH_AJS_LHOST
0 to 2 bytes
-
If checked
-h
-
If not checked
Null character string
Null character string
Permitted
ADSH_AJS_GCHE
0 to 2 bytes
-
If checked
-c
-
If not checked
Null character string
Null character string
Permitted
AJS_BJEX_STOP
4 bytes
"TERM"
"TERM"
Not permitted
-
-
Details of parameters passed to the job controller of JP1/Advanced Shell
The field Runtime parameters is defined as the prm parameter in the unit definition file and passed as a parameter for the job controller of JP1/Advanced Shell. The permitted values are as follows:
Input range: 1 to 1,023 bytes*
Setting: Character string
Initial value: Null character string
Omission: Permitted
To define for run-time parameters in the Define Execution dialog box a value equivalent to the null character string, define a single-byte space for the prm parameter in the unit definition file.
- *:
-
The maximum length of 1,023 bytes applies only when a character string consisting only of spaces is specified for the prm parameter. If any non-space characters are specified, the permitted maximum length is 1,022 bytes. If a character string consisting only of spaces is specified for the prm parameter, the specified character string minus a one-byte space is displayed in the Runtime parameters text box in the Define Execution dialog box.
- Important
-
Note the following points when deleting definition information in the unit definition file:
- For the env parameter, delete the value specified for the environment variable (character string following "=") or delete the specification of the env parameter itself.
- For the prm parameter, specify a single-byte space as the value for prm or delete the specification of the prm parameter itself.
The following is an example of a unit definition:
unit=Unit name,,Running user,; { ty=cpj; cty="ADSHUX"; sc="/opt/jp1as/bin/adshexec"; env="AJS_BJEX_STOP=TERM"; -->1. env="ADSH_AJS_SCRF=/tmp/JP1AS/scr/samplescrfile.ash"; -->2. prm="param1 param2"; -->3. env="ADSH_AJS_ENVF=/tmp/JP1AS/env/sampleenvfile"; -->4. env="ADSH_AJS_LHOST=-h"; -->5. env="ADSH_AJS_GCHE=-c"; -->6. tho=0; }
The following are descriptions corresponding to the numbers shown in the right margin:
-
AJS_BJEX_STOP: Because the AJS_BJEX_STOP environment variable is used by the system, make sure that you define this environment variable and specify TERM as its value.
-
ADSH_AJS_SCRF: Specifies the name of the job definition script file.
You must define the ADSH_AJS_SCRF environment variable.
-
The prm parameter is specified in the unit definition file.
-
ADSH_AJS_ENVF: Specifies the job environment file name.
-
ADSH_AJS_LHOST: If you want the job to be executed on a logical host, specify -h. In all other cases, do not specify anything.
-
ADSH_AJS_GCHE: If you want to perform only the precheck, specify -c. If all other cases, do not specify anything.
After creating the unit definition file, you can define the job by using the ajsdefine command of JP1/AJS or JP1/AJS3 - Definition Assistant.
(b) For the GUI application execution job
-
Environment variables configured in the Define Execution dialog box of JP1/Advanced Shell
ADSH_AJS_APPNAME: Application path name
ADSH_AJS_APPARG: Application parameter
ADSH_AJS_WORKF: Work folder
ADSH_AJS_SHOWN: Display name
ADSH_AJS_AFEXECMV: Behavior after executing the executable application
ADSH_AJS_MESOUT: Message output
-
Environment variables passed to the GUI application execution program
Environment variables are defined as env parameters of the unit definition file.
The following table shows the setting items for environment variables passed to the GUI application execution program.
Table 2‒30: Setting items for environment variables passed to the job controller of JP1/Advanced Shell Item name
Description
Input range
Number of bytes that can be specified as the value (character string following "=") of an environment variable (Shift-JIS)
Settings
Types of characters that can be defined
-
Character string: Characters other than control characters (0x00 to 0x1f, 0x7f)
-
Symbol name: Half-width alphanumeric characters, "@", "#", and "_"
-
Numeric characters
Initial value
Value loaded when a custom job is started as a new job
Omission
If the value cannot be omitted, an error will occur in the GUI application execution program.
The following table shows the input range and settings of environment variable items passed to the GUI application execution program.
Table 2‒31: Input range and settings of environment variable items passed to the GUI application execution program Environment variable
Input range
Settings
Initial value
Omission
ADSH_AJS_APPNAME
1 to 247 bytes
Character string
Null character string
Not permitted
ADSH_AJS_APPARG
0 to 1,023 bytes
Character string
Null character string
Permitted
ADSH_AJS_WORKF
1 to 247 bytes
Character string
Null character string
Permitted
ADSH_AJS_SHOWN
0 to 247 bytes
Character string
Null character string
Permitted
ADSH_AJS_AFEXECMV
0 to 2 bytes
-
If checked
-n
-
If not checked
Null character string
Null character string
Permitted
ADSH_AJS_MESOUT
0 to 2 bytes
-
If checked
-m
-
If not checked
Null character string
Null character string
Permitted
ADSH_AJS_APPEXEC
7 bytes
" APPEXEC "
" APPEXEC "
Not permitted
-
- Important
-
If you delete definition information from the unit definition file, delete the value of the environment variable (character string following "=") or delete the specification of the env parameter itself for the env parameter.
The following is an example of a unit definition:
unit=Unit name,,Running user,; { ty=cpj; cty="ADSHAPPEXEC"; sc=" C:\Program Files\HITACHI\JP1AS\JP1ASE\bin\adshappexec.exe"; env="ADSH_AJS_APPEXEC=APPEXEC"; -->1. env="ADSH_AJS_APPNAME=C:\ExecApp.exe"; -->2. env="ADSH_AJS_APPARG=param1 param2"; -->3. env="ADSH_AJS_WORKF=C:\work-folder"; -->4. env="ADSH_AJS_SHOWN=ExecApplication"; -->5. env="ADSH_AJS_AFEXECMV=-n"; -->6. env="ADSH_AJS_MESOUT=-m"; -->7. tho=0; }
The following are descriptions corresponding to the numbers shown in the right margin:
-
Because the ADSH_AJS_APPEXEC environment variable is used by the system, you must define this environment variable and specify APPEXEC as its value.
-
ADSH_AJS_APPNAME: Specifies the application path name.
You must define the ADSH_AJS_APPNAME.
-
ADSH_AJS_APPARG: Specifies the application parameter.
-
ADSH_AJS_WORKF: Specifies the work folder.
-
ADSH_AJS_SHOWN: Specifies the display name.
-
ADSH_AJS_AFEXECMV: If you want the action performed after the execution of the executable application to wait for termination, specify -n. In all other cases, do not specify anything.
-
ADSH_AJS_MESOUT: If you want to suppress output to the standard error output, specify -m. In all other cases, do not specify anything.
After creating the unit definition file, you can define the job by using the ajsdefine command of JP1/AJS or JP1/AJS3 - Definition Assistant.