Hitachi

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


5.8.5 Defining shell variables that handle path names

You can define the shell variable that handles the path name by using the PATH_CONV_NOVAR parameter or #-adsh_path_var command. If you use the shell variable that handles the path name, you can convert the path separator and directory separator containing the shell variable according to environment of Windows and UNIX.

You can define the shell variable that does not handle the path name by using the PATH_CONV_NOVAR parameter. Complicate specification is possible by combining with the specification of PATH_CONV_VAR.

The job controller converts the path and directory separators in character strings that satisfy all of the following conditions. For details about path conversion settings 1 and 2, see 7.3.34 PATH_CONV_RULE parameter (defines a rule for converting file paths) (Windows only).

You can use the #-adsh_path_var command only in either of the following cases:

You can specify a continuation line as shown below. Note that no shell variable name can be specified after the #-adsh_path_var command on the first line.

  Line 1: #-adsh_path_var
  Line 2: #-adsh  var001,var002,var003,var004
Organization of this subsection

(1) Examples

The example that the shell variable variables "PATH", "DIR" and "DIR3" are defined for the #-adsh_path_var command and PATH_CONV_VAR parameter is as follows:

(a) In Windows

  • Specification of the environment file

    #-adsh_conf PATH_CONV_ENABLE / :    <--Enable path conversion.
    #-adsh_conf PATH_CONV_RULE 1                       <--Select path conversion setting 1.
    #-adsh_conf PATH_CONV /home/hitachi "C:\\hitachi"  <--Path string substitution 1.
    #-adsh_conf PATH_CONV /tmp/jp1as "D:\\jp1as_tmp"   <--Path string substitution 2.
    #-adsh_conf PATH_CONV /tmp "C:\\temp"              <--Path string substitution 3.
    #-adsh_conf PATH_CONV_ACCESS /dev/null nul    <--Convert file paths during file input and output.
    #-adsh_conf PATH_CONV_VAR DIR3                     <--  Shell variable definition 1
  • Specification of the job definition script

    #-adsh_path_var PATH,DIR         <-- Shell variable definition 2
     
    DIR="/home/hitachi/bin"    <--Convert to DIR="C:\\hitachi\\bin" by path string substitution 1.
     
    "$DIR/myprog"    <--Convert to "$DIR\\myprog" by shell variable definition 2.
     
    "${DIR}/myprog"    <--Convert to "${DIR}\\myprog" by shell variable definition 2.
     
    DIR2=$DIR
    "$DIR2/myprog"    <--$DIR2 is not converted because it is not in shell variable definition 1, 2.
     
    $DIR/myprog    <--Not converted because this is not enclosed in double quotation marks (").
     
    FILE1="/tmp/jp1as/file"    <--Convert to "D:\\jp1as_tmp\\file" by path string substitution 2.
     
    DIR3=""
    ls "$DIR3../bin"    <--Convert to "..\\bin" by shell variable definition 1. Relative paths are also converted.
     
    DIR4="/home/hitachi/sbin:$DIR2"    <--Convert to C:\\hitachi\\sbin;$DIR2 by path string substitution 1. Path separators are also converted.
     
    PATH="../bin/:$DIR"    <--Convert to ..\\bin\\;$DIR by shell variable definition 2. Path separators are also converted.
     
    "$DIR2/myprog" > /dev/null    <--Convert to nul by file path conversion during file input and output.

(b) In UNIX

  • Specification of the environment file

    #-adsh_conf PATH_CONV_ENABLE \\ ;    <--Enable path conversion.
    #-adsh_conf PATH_CONV "C:\\hitachi" /home/hitachi  <--Path string substitution 1.
    #-adsh_conf PATH_CONV "D:\\jp1as_tmp" /tmp/jp1as   <--Path string substitution 2.
    #-adsh_conf PATH_CONV "C:\\temp" /tmp     <--Path string substitution 3.
    #-adsh_conf PATH_CONV_ACCESS nul /dev/null    <--Convert file paths during file input and output.
    #-adsh_conf PATH_CONV_VAR DIR3                     <--  Shell variable definition 1
  • Specification of the job definition script

    #-adsh_path_var PATH,DIR         <-- Shell variable definition 2
    DIR="C:\\hitachi\\bin"    <--Convert to DIR="/home/hitachi/bin" by path string substitution 1.
    "$DIR\\myprog"    <--Convert to "$DIR/myprog" by shell variable definition 2.
     
    "${DIR}\\myprog"    <--Convert to "${DIR}/myprog" by shell variable definition 2.
     
    DIR2=$DIR
    "$DIR2\\myprog"    <--$DIR2 is not converted because it is not in shell variable definition 1, 2.
     
    $DIR\\myprog    <--Not converted because this is not enclosed in double quotation marks (").
     
    FILE1="D:\\jp1as_tmp\\file"    <--Convert to "/tmp/jp1as/file" by path string substitution 2.
     
    DIR3=""
    ls "$DIR3..\\bin"    <--Convert to "../bin" by shell variable definition 1. Relative paths are also converted.
     
    DIR4="C:\\hitachi\\sbin;$DIR2"    <--Convert to /home/hitachi/sbin:$DIR2 by path string substitution 1. Path separators are also converted.
     
    PATH="..\\bin\\;$DIR"    <--Convert to ../bin/:$DIR by shell variable definition 2. Path separators are also converted.
     
    "$DIR2\\myprog" > nul    <--Convert to /dev/null by file path conversion during file input and output.

(c) Example of use of PATH_CONV_VAR parameter and PATH_CONV_NOVAR parameter

  • Specification of the environment file

    #-adsh_conf PATH_CONV_VAR DIR*                <-- Definition 1 of shell variable
    #-adsh_conf PATH_CONV_NOVAR DIRNO*            <-- Definition 2 of shell variable

    For definition 1 of shell variable, the shell variable in which the beginning of the name is DIR is defined as the shell variable that handles the path name. For definition 2 of shell variable, the shell variable in which the beginning of the name is DIR is defined as the shell variable that does not handle the path name. The subsequent specification is prioritized so that the shell variable in which the beginning of the name is defined as the shell variable handling the path name except for the shell variable in which the beginning of the name is DIRNO.

  • Specification of the job definition script

    #-adsh_path_var DIRNORTH                       <-- Definition 3 of shell variable

    DIRNORTH is defined as the shell variable handling the path name.# Definition of the -adsh_path_var command is prioritized over the definition of the environment file. Therefore, DIRNOTH is the variable even if the beginning of the name is DIRNO.

(2) Example output to job definition script images

JP1/Advanced Shell outputs a job definition script before path conversion and the lines after conversion to job execution logs. JP1/Advanced Shell also outputs as messages the conversion rules that were satisfied in the job definition script, job definition script name, and line numbers.

********  JOB CONTROLLER MESSAGE  ********
(omitted)
10:48:48 000007 KNAX6803-I The access path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=4 path converted="./local.log":".\\mylog"
(omitted)
 
********   Script IMAGE    ********
 
***** D:\home\user001\path_conv.ash *****
0001 : #-adsh_job JOB001
0002 : #-adsh_path_var DIR
0003 : DIR="/home/hitachi/bin"; DIR2="/tmp/tmpfile"
0004 : "$DIR/myprog" > ./local.log
0005 : exit
 
***** Converted lines in "D:\home\user001\path_conv.ash" *****
0003 : DIR="c:\\Program Files"; DIR2="c:\\temp\\tmpfile"
0004 : "$DIR\\myprog" > ./local.log
 
***** CONVERSION INFORMATION *****
KNAX6800-I The path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=3 path converted="/home/hitachi/bin":"c:\\Program Files"
KNAX6800-I The path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=3 path converted="/tmp":"c:\\temp"
KNAX6801-I The path matched the conversion rule. filename="D:\home\user001\path_conv.ash" line=4 shell variable handling path="DIR"